From d573a06eb6d57f3f10003284161974d924ab6056 Mon Sep 17 00:00:00 2001 From: ecionis Date: Sat, 21 Jul 2018 10:26:47 +0800 Subject: [PATCH] content_length zero: client https://github.com/warmcat/libwebsockets/issues/1337 --- lib/roles/http/client/client.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/roles/http/client/client.c b/lib/roles/http/client/client.c index 5645fa2b7..8aba185b8 100644 --- a/lib/roles/http/client/client.c +++ b/lib/roles/http/client/client.c @@ -954,6 +954,15 @@ lws_client_interpret_server_handshake(struct lws *wsi) lwsl_info("%s: client connection up\n", __func__); + /* + * Did we get a response from the server with an explicit + * content-length of zero? If so, this transaction is already + * completed at the end of the header processing... + */ + if (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_CONTENT_LENGTH) && + !wsi->http.rx_content_length) + return !!lws_http_transaction_completed_client(wsi); + return 0; }