[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] evhttp: Abort after receiving a certain number of bytes



Hi,

I just tested and the following change seems to work fine:

Âif (req->body_size + req->ntoread > req->evcon->max_body_size) {

This is wrong case of chunked response and inaccurate when ntoread < 0.

I'd suggest to add something like

if (!req->chunked && req->ntoread > 0 && req->ntoread > req->evcon->max_body_size) {
ÂÂ evhttp_connection_fail(...);
}

in the beginning of evhttp_read_body().

--
WBR,
 Constantine