diff --git a/lib/core/context.c b/lib/core/context.c index dd4bfd20e..37ab0248f 100644 --- a/lib/core/context.c +++ b/lib/core/context.c @@ -362,6 +362,7 @@ lws_callback_http_dummy(struct lws *wsi, enum lws_callback_reasons reason, return -1; break; #if !defined(LWS_NO_SERVER) + case LWS_CALLBACK_HTTP_BODY_COMPLETION: case LWS_CALLBACK_HTTP_FILE_COMPLETION: if (lws_http_transaction_completed(wsi)) return -1; diff --git a/lib/roles/h1/ops-h1.c b/lib/roles/h1/ops-h1.c index 938642502..1f5435619 100644 --- a/lib/roles/h1/ops-h1.c +++ b/lib/roles/h1/ops-h1.c @@ -119,6 +119,10 @@ lws_read_h1(struct lws *wsi, unsigned char *buf, lws_filepos_t len) http_postbody: lwsl_debug("%s: http post body: remain %d\n", __func__, (int)wsi->http.rx_content_remain); + + if (!wsi->http.rx_content_remain) + goto postbody_completion; + while (len && wsi->http.rx_content_remain) { /* Copy as much as possible, up to the limit of: * what we have in the read buffer (len)