cgi: if we ask for writable to send chunk end, defer close
This commit is contained in:
parent
cad115bf6b
commit
f06967fa84
2 changed files with 10 additions and 9 deletions
|
@ -260,9 +260,8 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
if (wsi->reason_bf & LWS_CB_REASON_AUX_BF__CGI_CHUNK_END) {
|
||||
n = lws_write(wsi, (unsigned char *)"0\x0d\x0a\x0d\x0a",
|
||||
5, LWS_WRITE_HTTP);
|
||||
if (n < 0)
|
||||
return -1;
|
||||
break;
|
||||
/* always close after sending it */
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#if defined(LWS_WITH_HTTP_PROXY)
|
||||
|
@ -386,6 +385,8 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
/* send terminating chunk */
|
||||
wsi->reason_bf |= LWS_CB_REASON_AUX_BF__CGI_CHUNK_END;
|
||||
lws_callback_on_writable(wsi);
|
||||
lws_set_timeout(wsi, PENDING_TIMEOUT_CGI, 3);
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -3090,13 +3090,13 @@ lws_cgi_kill(struct lws *wsi)
|
|||
handled:
|
||||
args.stdwsi = &wsi->cgi->stdwsi[0];
|
||||
|
||||
if (wsi->cgi->pid != -1 && user_callback_handle_rxflow(
|
||||
wsi->protocol->callback,
|
||||
wsi, LWS_CALLBACK_CGI_TERMINATED,
|
||||
wsi->user_space,
|
||||
(void *)&args, 0)) {
|
||||
if (wsi->cgi->pid != -1) {
|
||||
n = user_callback_handle_rxflow(wsi->protocol->callback, wsi,
|
||||
LWS_CALLBACK_CGI_TERMINATED,
|
||||
wsi->user_space,
|
||||
(void *)&args, 0);
|
||||
wsi->cgi->pid = -1;
|
||||
if (!wsi->cgi->being_closed)
|
||||
if (n && !wsi->cgi->being_closed)
|
||||
lws_close_free_wsi(wsi, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue