Author: rhuijben Date: Tue Nov 17 13:40:01 2015 New Revision: 1714781 URL: http://svn.apache.org/viewvc?rev=1714781&view=rev Log: Fix a very old bug in the header buckets readline that we somehow never noticed in our previous uses of this bucket.
Reading the header buckets as an incoming request triggered this bug while testing the fcgi code. (Assuming the next commit) * buckets/headers_buckets.c (serf_headers_readline): Calculate the kind of newline *before* changing the state for the next read. Modified: serf/trunk/buckets/headers_buckets.c Modified: serf/trunk/buckets/headers_buckets.c URL: http://svn.apache.org/viewvc/serf/trunk/buckets/headers_buckets.c?rev=1714781&r1=1714780&r2=1714781&view=diff ============================================================================== --- serf/trunk/buckets/headers_buckets.c (original) +++ serf/trunk/buckets/headers_buckets.c Tue Nov 17 13:40:01 2015 @@ -407,12 +407,12 @@ static apr_status_t serf_headers_readlin return APR_EOF; } - /* we consumed this chunk. advance the state. */ - status = consume_chunk(ctx); - /* the type of newline found is easy... */ *found = (ctx->state == READ_CRLF || ctx->state == READ_TERM) - ? SERF_NEWLINE_CRLF : SERF_NEWLINE_NONE; + ? SERF_NEWLINE_CRLF : SERF_NEWLINE_NONE; + + /* we consumed this chunk. advance the state. */ + status = consume_chunk(ctx); return status; }