From e04a3cf132bf4c0c184d24edb9870a8d7f60d15c Mon Sep 17 00:00:00 2001 From: stropee <simon@sirocha.fr> Date: Sun, 20 Oct 2024 15:39:06 +0200 Subject: [PATCH] http: pipeline: handle methods lacking COMPLETED_CLIENT_HTTP Signed-off-by: stropee <simon@sirocha.fr> --- lib/roles/http/client/client-http.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/roles/http/client/client-http.c b/lib/roles/http/client/client-http.c index 05532f295..89ec33f00 100644 --- a/lib/roles/http/client/client-http.c +++ b/lib/roles/http/client/client-http.c @@ -1373,10 +1373,15 @@ 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. */ - if (!wsi->mux_substream && !wsi->client_mux_substream && + 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) + (!wsi->http.rx_content_length || + (simp && !strcmp(simp,"HEAD")))) return !!lws_http_transaction_completed_client(wsi); /*