[Libwebsockets] Websocket header verification

techi eth techieth at gmail.com
Thu Jan 19 10:39:02 CET 2017


Thanks for quick answer.

Yes,I was looking before wsupgrade.
Is their any possibility to send user specific code (The way we send with
close connection) so that client will know reason for disconnection.

On Thu, Jan 19, 2017 at 2:59 PM, Andy Green <andy at warmcat.com> wrote:

>
>
> On 01/19/2017 05:21 PM, techi eth wrote:
>
>>
>> Hi,
>>
>> Is it possible to check Header before accepting client connection with
>> libwebsocket ?
>>
>
> Depends what you mean by "accept"... tcp accept, no, because you have to
> make the tcp connection to get the headers.
>
> Accept to perform the ws upgrade... sure...
>
>     LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION            = 20,
>     /**< called when the handshake has
>      * been received and parsed from the client, but the response is
>      * not sent yet.  Return non-zero to disallow the connection.
>      * user is a pointer to the connection user space allocation,
>      * in is the requested protocol name
>      * In your handler you can use the public APIs
>      * lws_hdr_total_length() / lws_hdr_copy() to access all of the
>      * headers using the header enums lws_token_indexes from
>      * libwebsockets.h to check for and read the supported header
>      * presence and content before deciding to allow the handshake
>      * to proceed or to kill the connection. */
>
> -Andy
>
>
>>
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
>> https://libwebsockets.org/mailman/listinfo/libwebsockets
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170119/73ae0766/attachment-0002.html>


More information about the Libwebsockets mailing list