On 9 November 2015 at 15:03, <rhuij...@apache.org> wrote: > Author: rhuijben > Date: Mon Nov 9 12:03:42 2015 > New Revision: 1713402 > > URL: http://svn.apache.org/viewvc?rev=1713402&view=rev > Log: > Make the limit bucket verify that it actually limits the result and not > just passes EOF early. Add some testing on the limit bucket while we're > working on it. > > * buckets/limit_buckets.c > (serf_limit_read, > serf_limit_read_iovec): Don't just pass early EOF as non failure. > > * test/test_buckets.c > (test_limit_buckets): New function. > (test_buckets): Add test_limit_buckets. > > Modified: > serf/trunk/buckets/limit_buckets.c > serf/trunk/test/test_buckets.c > > Modified: serf/trunk/buckets/limit_buckets.c > URL: > http://svn.apache.org/viewvc/serf/trunk/buckets/limit_buckets.c?rev=1713402&r1=1713401&r2=1713402&view=diff > ============================================================================== > --- serf/trunk/buckets/limit_buckets.c (original) > +++ serf/trunk/buckets/limit_buckets.c Mon Nov 9 12:03:42 2015 > @@ -66,11 +66,14 @@ static apr_status_t serf_limit_read(serf > > if (!SERF_BUCKET_READ_ERROR(status)) { > ctx->remaining -= *len; > - } > > - /* If we have met our limit and don't have a status, return EOF. */ > - if (!ctx->remaining && !status) { > - status = APR_EOF; > + /* If we have met our limit and don't have a status, return EOF. */ > + if (!ctx->remaining && !status) { > + status = APR_EOF; > + } > + else if (APR_STATUS_IS_EOF(status) && ctx->remaining) { > + status = SERF_ERROR_TRUNCATED_HTTP_RESPONSE; I think we cannot use SERF_ERROR_TRUNCATED_HTTP_RESPONSE in limits buckets, since limit bucket could be used for something else than HTTP responses.
-- Ivan Zhakov