From 6830f2d29643c2ab573db7df8206b1d067f1002a Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 30 Nov 2018 08:41:30 +0800 Subject: [PATCH] cgi: use transaction_complete when stdout goes away transaction_complete includes processing for the case we are holding an output-side buflist, and arranges for it to be sent before the connection is actually closed. This stops very slow links not being ablet to use git clone via cgi mount, because the close races the flushing of the output-side buflist and in the case the connection is bad, closes before everything was sent. --- lib/core/dummy-callback.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/core/dummy-callback.c b/lib/core/dummy-callback.c index 8fd18be9c..5dd384953 100644 --- a/lib/core/dummy-callback.c +++ b/lib/core/dummy-callback.c @@ -155,7 +155,9 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason, LWS_WRITE_HTTP_FINAL); /* always close after sending it */ - return -1; + if (lws_http_transaction_completed(wsi)) + return -1; + return 0; } #endif #if defined(LWS_WITH_HTTP_PROXY) @@ -462,7 +464,9 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason, lws_set_timeout(wsi, PENDING_TIMEOUT_CGI, 3); break; } - return -1; + if (lws_http_transaction_completed(wsi)) + return -1; + return 0; case LWS_CALLBACK_CGI_STDIN_DATA: /* POST body for stdin */ args = (struct lws_cgi_args *)in;