1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

fix HEAD method complete callback check, check if the value returned by lws_hdr_simple_ptr is not null

Signed-off-by: stropee <stropee@sirocha.fr>
This commit is contained in:
stropee 2024-10-31 18:36:00 +01:00
parent 9fac6fc1dd
commit 4a99ae7971

View file

@ -1373,12 +1373,17 @@ lws_client_interpret_server_handshake(struct lws *wsi)
* content-length of zero? If so, and it's not H2 which will
* notice it via END_STREAM, this transaction is already
* completed at the end of the header processing...
* We also completed it if the request method is HEAD which as
* no content leftover.
*/
simp = lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_METHOD);
if (!wsi->mux_substream && !wsi->client_mux_substream &&
lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH) &&
(!wsi->http.rx_content_length || !strcmp(lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_METHOD),"HEAD")))
lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH) &&
(!wsi->http.rx_content_length || (NULL != simp &&
!strcmp(simp,"HEAD"))))
return !!lws_http_transaction_completed_client(wsi);
/*
* We can also get a case where it's http/1 and there's no
* content-length at all, so anything that comes is the body