mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
introduce LWS_CALLBACK_FILTER_HTTP_CONNECTION
Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
6cd8880f23
commit
19895bcfd4
2 changed files with 18 additions and 0 deletions
|
@ -145,6 +145,11 @@ libwebsocket_read(struct libwebsocket_context *context,
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
if (wsi->protocol->callback)
|
if (wsi->protocol->callback)
|
||||||
|
n = wsi->protocol->callback(context, wsi,
|
||||||
|
LWS_CALLBACK_FILTER_HTTP_CONNECTION,
|
||||||
|
wsi->user_space, uri_ptr, uri_len);
|
||||||
|
|
||||||
|
if (!n && wsi->protocol->callback)
|
||||||
n = wsi->protocol->callback(context, wsi,
|
n = wsi->protocol->callback(context, wsi,
|
||||||
LWS_CALLBACK_HTTP,
|
LWS_CALLBACK_HTTP,
|
||||||
wsi->user_space, uri_ptr, uri_len);
|
wsi->user_space, uri_ptr, uri_len);
|
||||||
|
|
|
@ -148,6 +148,7 @@ enum libwebsocket_callback_reasons {
|
||||||
LWS_CALLBACK_HTTP_FILE_COMPLETION,
|
LWS_CALLBACK_HTTP_FILE_COMPLETION,
|
||||||
LWS_CALLBACK_HTTP_WRITEABLE,
|
LWS_CALLBACK_HTTP_WRITEABLE,
|
||||||
LWS_CALLBACK_FILTER_NETWORK_CONNECTION,
|
LWS_CALLBACK_FILTER_NETWORK_CONNECTION,
|
||||||
|
LWS_CALLBACK_FILTER_HTTP_CONNECTION,
|
||||||
LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION,
|
LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION,
|
||||||
LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS,
|
LWS_CALLBACK_OPENSSL_LOAD_EXTRA_CLIENT_VERIFY_CERTS,
|
||||||
LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS,
|
LWS_CALLBACK_OPENSSL_LOAD_EXTRA_SERVER_VERIFY_CERTS,
|
||||||
|
@ -492,6 +493,18 @@ struct libwebsocket_extension;
|
||||||
* Because this happens immediately after the network connection
|
* Because this happens immediately after the network connection
|
||||||
* from the client, there's no websocket protocol selected yet so
|
* from the client, there's no websocket protocol selected yet so
|
||||||
* this callback is issued only to protocol 0.
|
* this callback is issued only to protocol 0.
|
||||||
|
*
|
||||||
|
* LWS_CALLBACK_FILTER_HTTP_CONNECTION: called when the request 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 URI, eg, "/"
|
||||||
|
* 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 http
|
||||||
|
* connection to proceed or to kill the connection.
|
||||||
*
|
*
|
||||||
* LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: called when the handshake has
|
* LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION: called when the handshake has
|
||||||
* been received and parsed from the client, but the response is
|
* been received and parsed from the client, but the response is
|
||||||
|
|
Loading…
Add table
Reference in a new issue