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.
This commit is contained in:
Nick Mathewson 2010-10-25 16:09:11 -04:00
parent 58a1cc6bc8
commit 8e342e5630

2
http.c
View File

@ -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