POST handling dont autocomplete transaction
Until now lws has finished the HTTP transaction when the POST body was completely received. However that needlessly makes it impossible to send a HTTP 200 and a response without a redirect. This changes lws behaviour after sending the LWS_CALLBACK_HTTP_BODY_COMPLETION callback to no longer terminate the HTTP transaction. If you want the old behaviour, you can terminate the transaction with lws_http_transaction_completed() in the LWS_CALLBACK_HTTP_BODY_COMPLETION callback. Otherwise it's now possible to call lws_callback_on_writable() from LWS_CALLBACK_HTTP_BODY_COMPLETION. Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
0daa1869b2
commit
fc29185b9f
1 changed files with 1 additions and 15 deletions
|
@ -211,7 +211,7 @@ postbody_completion:
|
|||
goto bail;
|
||||
}
|
||||
|
||||
goto http_complete;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -241,20 +241,6 @@ read_ok:
|
|||
|
||||
return buf - oldbuf;
|
||||
|
||||
http_complete:
|
||||
lwsl_debug("%s: http_complete\n", __func__);
|
||||
|
||||
#ifndef LWS_NO_SERVER
|
||||
/* Did the client want to keep the HTTP connection going? */
|
||||
if (lws_http_transaction_completed(wsi))
|
||||
goto bail;
|
||||
#endif
|
||||
/* we may have next header set already, but return to event loop first
|
||||
* so a heaily-pipelined http/1.1 connection cannot monopolize the
|
||||
* service thread with GET hugefile.bin GET hugefile.bin etc
|
||||
*/
|
||||
goto read_ok;
|
||||
|
||||
bail:
|
||||
lwsl_debug("closing connection at lws_read bail:\n");
|
||||
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS);
|
||||
|
|
Loading…
Add table
Reference in a new issue