From 8e342e563060a5dfc4c33bd46a2a6819a5d5b2f7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 25 Oct 2010 16:09:11 -0400 Subject: [PATCH] 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. --- http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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