From: Nick Mathewson Date: Mon, 25 Oct 2010 20:09:11 +0000 (-0400) Subject: Correctly count req->body_size on http usage without Content-Length X-Git-Tag: release-2.0.9-rc~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e342e563060a5dfc4c33bd46a2a6819a5d5b2f7;p=libevent Correctly count req->body_size on http usage without Content-Length There was a dumb bug where we would look at the length of the input buffer immediately _after_ we drained it. --- diff --git a/http.c b/http.c index 526244ae..ce120bcc 100644 --- a/http.c +++ b/http.c @@ -874,8 +874,8 @@ evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req) } } else if (req->ntoread < 0) { /* Read until connection close. */ - evbuffer_add_buffer(req->input_buffer, buf); req->body_size += evbuffer_get_length(buf); + evbuffer_add_buffer(req->input_buffer, buf); } else if (req->chunk_cb != NULL || evbuffer_get_length(buf) >= (size_t)req->ntoread) { /* We've postponed moving the data until now, but we're