mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
reverse-proxy: allow proxying rfc8441 ws CONNECT
Take the opportunity to provide public method index constants
This commit is contained in:
parent
2b456e734a
commit
7dcb4eeaa6
2 changed files with 16 additions and 12 deletions
|
@ -620,6 +620,18 @@ lws_add_http_common_headers(struct lws *wsi, unsigned int code,
|
|||
const char *content_type, lws_filepos_t content_len,
|
||||
unsigned char **p, unsigned char *end);
|
||||
|
||||
enum {
|
||||
LWSHUMETH_GET,
|
||||
LWSHUMETH_POST,
|
||||
LWSHUMETH_OPTIONS,
|
||||
LWSHUMETH_PUT,
|
||||
LWSHUMETH_PATCH,
|
||||
LWSHUMETH_DELETE,
|
||||
LWSHUMETH_CONNECT,
|
||||
LWSHUMETH_HEAD,
|
||||
LWSHUMETH_COLON_PATH,
|
||||
};
|
||||
|
||||
/**
|
||||
* lws_http_get_uri_and_method() - Get information on method and url
|
||||
*
|
||||
|
@ -627,17 +639,7 @@ lws_add_http_common_headers(struct lws *wsi, unsigned int code,
|
|||
* \param puri_ptr: points to pointer to set to url
|
||||
* \param puri_len: points to int to set to uri length
|
||||
*
|
||||
* Returns -1 or method index
|
||||
*
|
||||
* GET 0
|
||||
* POST 1
|
||||
* OPTIONS 2
|
||||
* PUT 3
|
||||
* PATCH 4
|
||||
* DELETE 5
|
||||
* CONNECT 6
|
||||
* HEAD 7
|
||||
* :path 8
|
||||
* Returns -1 or method index as one of the LWSHUMETH_ constants
|
||||
*
|
||||
* If returns method, *puri_ptr is set to the method's URI string and *puri_len
|
||||
* to its length
|
||||
|
|
|
@ -465,7 +465,9 @@ lws_process_ws_upgrade(struct lws *wsi)
|
|||
meth = lws_http_get_uri_and_method(wsi, &uri_ptr, &uri_len);
|
||||
hit = lws_find_mount(wsi, uri_ptr, uri_len);
|
||||
|
||||
if (hit && (meth == 0 || meth == 8) &&
|
||||
if (hit && (meth == LWSHUMETH_GET ||
|
||||
meth == LWSHUMETH_CONNECT ||
|
||||
meth == LWSHUMETH_COLON_PATH) &&
|
||||
(hit->origin_protocol == LWSMPRO_HTTPS ||
|
||||
hit->origin_protocol == LWSMPRO_HTTP))
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue