[Libwebsockets] How to reject the WS request with a 403 status

Chropin Hu chropinhu at gmail.com
Tue Jul 24 11:07:23 CEST 2018

Dear All,
      I am researching a way to varify the |origin| filed at the websocket
handshake stage. (none TLS case)
      if the orgin is invalid, the server will return  403 forbidden status
      I have try to handle the *LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION*
msg like this,
              unsigned char buf[LWS_PRE + 384], *start = buf + LWS_PRE - 1,
*p = start,
     *end = buf + sizeof(buf) - 1;
      lws_add_http_header_status(wsi, HTTP_STATUS_FORBIDDEN, &p, end);
     But it can not work well.
     Someone can help me out?

Best Regards

Yours Chropin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20180724/559a6338/attachment.html>

More information about the Libwebsockets mailing list