From: Jeff Trawick Date: Wed, 17 Sep 2003 10:47:39 +0000 (+0000) Subject: merge this fix from 2.1-dev: X-Git-Tag: 2.0.48~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3a88de3f47423f6f50fd64d261bb217ff8c04ea;p=thirdparty%2Fapache%2Fhttpd.git merge this fix from 2.1-dev: * Fix EOS handling in ap_get_client_block. Submitted by: jerenkrantz Reviewed by: trawick, fielding git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@101265 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index b5a7e06fdca..11ebf5f01ac 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.48 + *) Modify ap_get_client_block() to note if it has seen EOS. + [Justin Erenkrantz] + *) Fix a bug, where mod_deflate sometimes unconditionally compressed the content if the Accept-Encoding header contained only other tokens than "gzip" (such as "deflate"). PR 21523. [Joe Orton, André Malo] diff --git a/STATUS b/STATUS index b840e33b036..0b6f52173b2 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 2.0 STATUS: -*-text-*- -Last modified at [$Date: 2003/09/17 10:39:43 $] +Last modified at [$Date: 2003/09/17 10:47:38 $] Release: @@ -333,11 +333,6 @@ PATCHES TO PORT FROM 2.1 modules/ssl/ssl_engine_io.c r1.111 +1: jorton - * Fix EOS handling in ap_get_client_block. - modules/http/http_protocol.c: r1.471 - See Message-ID: <3EC0B430.4010008@stason.org> - +1: jerenkrantz, trawick, fielding - CURRENT RELEASE NOTES: * Backwards compatibility is expected of future Apache 2.0 releases, diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 8d120bb767b..e80c531eaf4 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1890,6 +1890,10 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_status_t rv; apr_bucket_brigade *bb; + if (r->remaining < 0 || (!r->read_chunked && r->remaining == 0)) { + return 0; + } + bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); if (bb == NULL) { r->connection->keepalive = AP_CONN_CLOSE; @@ -1916,7 +1920,21 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, * returning data when requested. */ AP_DEBUG_ASSERT(!APR_BRIGADE_EMPTY(bb)); - + + /* Check to see if EOS in the brigade. + * + * If so, we have to leave a nugget for the *next* ap_get_client_block + * call to return 0. + */ + if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { + if (r->read_chunked) { + r->remaining = -1; + } + else { + r->remaining = 0; + } + } + rv = apr_brigade_flatten(bb, buffer, &bufsiz); if (rv != APR_SUCCESS) { apr_brigade_destroy(bb);