diff options
author | Vitaliy Orazov <vitaly.orazov@rubetek.com> | 2021-11-29 17:26:48 +0300 |
---|---|---|
committer | Andy Green <andy@warmcat.com> | 2021-11-29 15:26:04 +0000 |
commit | 0dc0f92f29da0d3320a8c1b9f42830ee7531924f (patch) | |
tree | 5e50590d7d05b17d858775c72700fd0a5508eea8 | |
parent | 741cf67b7fc66857332c29bc165bada0a03c8309 (diff) | |
download | libwebsockets-0dc0f92f29da0d3320a8c1b9f42830ee7531924f.tar.gz |
http proxy: support PUT, PATCH and DELETE methods
-rw-r--r-- | lib/roles/http/server/server.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c index 57953cac..bd38a33f 100644 --- a/lib/roles/http/server/server.c +++ b/lib/roles/http/server/server.c @@ -1393,6 +1393,36 @@ lws_http_proxy_start(struct lws *wsi, const struct lws_http_mount *hit, #endif ) i.method = "POST"; + else if (lws_hdr_simple_ptr(wsi, WSI_TOKEN_PUT_URI) +#if defined(LWS_WITH_HTTP2) + || ( + lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_COLON_METHOD) && + !strcmp(lws_hdr_simple_ptr(wsi, + WSI_TOKEN_HTTP_COLON_METHOD), "put") + ) +#endif + ) + i.method = "PUT"; + else if (lws_hdr_simple_ptr(wsi, WSI_TOKEN_PATCH_URI) +#if defined(LWS_WITH_HTTP2) + || ( + lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_COLON_METHOD) && + !strcmp(lws_hdr_simple_ptr(wsi, + WSI_TOKEN_HTTP_COLON_METHOD), "patch") + ) +#endif + ) + i.method = "PATCH"; + else if (lws_hdr_simple_ptr(wsi, WSI_TOKEN_DELETE_URI) +#if defined(LWS_WITH_HTTP2) + || ( + lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_COLON_METHOD) && + !strcmp(lws_hdr_simple_ptr(wsi, + WSI_TOKEN_HTTP_COLON_METHOD), "delete") + ) +#endif + ) + i.method = "DELETE"; else i.method = "GET"; } |