kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit ad5d662556a624cd48cada39a50bbb97858d6c36
parent f8a9ece9a61fe16d9d679fd7d13bf73b2cef0f49
Author: Joris Vink <joris@coders.se>
Date:   Mon, 16 Mar 2015 16:37:30 +0100

Use net_recv_reset() if more body bytes are coming.

Unbreaks clients that send the headers first and the
actual HTTP body after X amount of time.

Diffstat:
src/http.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/http.c b/src/http.c @@ -648,7 +648,8 @@ http_header_recv(struct netbuf *nb) if (bytes_left > 0) { kore_debug("%ld/%ld (%ld - %ld) more bytes for body", bytes_left, clen, nb->s_off, len); - net_recv_expand(c, bytes_left, req, http_body_recv); + c->rnb->extra = req; + net_recv_reset(c, bytes_left, http_body_recv); } else if (bytes_left == 0) { req->flags |= HTTP_REQUEST_COMPLETE; req->flags &= ~HTTP_REQUEST_EXPECT_BODY; @@ -1121,6 +1122,7 @@ http_body_recv(struct netbuf *nb) req->flags |= HTTP_REQUEST_COMPLETE; req->flags &= ~HTTP_REQUEST_EXPECT_BODY; + nb->extra = NULL; kore_debug("received all body data for request %p", req); return (KORE_RESULT_OK);