From: Joe Orton Date: Thu, 20 Jan 2005 09:33:02 +0000 (+0000) Subject: Merge r105297, r105664 from trunk: X-Git-Tag: 2.0.53~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c31e8a472f9ff8f484bccc1e72e98824aad6d70;p=thirdparty%2Fapache%2Fhttpd.git Merge r105297, r105664 from trunk: * server/util_filter.c (ap_save_brigade): Handle an ENOTIMPL setaside function correctly. * server/util_filter.c (ap_save_brigade): Be more tolerant of a bucket type which neither implements ->setaside nor morphs on ->read, such as the mod_perl SV bucket type in mod_perl <1.99_17; defer returning an error in this case until after calling setaside on each bucket. PR: 31247 Reviewed by: jorton, trawick, stoddard git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@125745 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index a0db7eb28b1..085341083ee 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.53 + *) Correct handling of certain bucket types in ap_save_brigade, fixing + possible segfaults in mod_cgi with #include virtual. PR 31247. + [Joe Orton] + *) Allow for the use of --with-module=foo:bar where the ./modules/foo directory is local only. Assumes, of course, that the required files are in ./modules/foo, but makes it easier to statically diff --git a/STATUS b/STATUS index 824a55414d1..ce970b5fd57 100644 --- a/STATUS +++ b/STATUS @@ -178,11 +178,6 @@ PATCHES TO BACKPORT FROM 2.1 PR 24437 +1: minfrin, wrowe, jim - *) Fix ap_save_brigade's handling of ENOTIMPL setaside functions. - http://cvs.apache.org/viewcvs.cgi/httpd-2.0/server/util_filter.c?r1=1.100&r2=1.102 - PR: 31247 - +1: jorton, trawick, stoddard - *) mod_headers: Support {...}s tag for SSL variable lookup. http://www.apache.org/~jorton/mod_headers-2.0-ssl.diff +1: jorton, trawick diff --git a/server/util_filter.c b/server/util_filter.c index 9a4b9e512ed..74acb413525 100644 --- a/server/util_filter.c +++ b/server/util_filter.c @@ -518,7 +518,7 @@ AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, apr_bucket_brigade **b, apr_pool_t *p) { apr_bucket *e; - apr_status_t rv; + apr_status_t rv, srv = APR_SUCCESS; /* If have never stored any data in the filter, then we had better * create an empty bucket brigade so that we can concat. @@ -529,15 +529,31 @@ AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f, APR_RING_FOREACH(e, &(*b)->list, apr_bucket, link) { rv = apr_bucket_setaside(e, p); - if (rv != APR_SUCCESS - /* ### this ENOTIMPL will go away once we implement setaside - ### for all bucket types. */ - && rv != APR_ENOTIMPL) { - return rv; + + /* If the bucket type does not implement setaside, then + * (hopefully) morph it into a bucket type which does, and set + * *that* aside... */ + if (rv == APR_ENOTIMPL) { + const char *s; + apr_size_t n; + + rv = apr_bucket_read(e, &s, &n, APR_BLOCK_READ); + if (rv == APR_SUCCESS) { + rv = apr_bucket_setaside(e, p); + } + } + + if (rv != APR_SUCCESS) { + srv = rv; + /* Return an error but still save the brigade if + * ->setaside() is really not implemented. */ + if (rv != APR_ENOTIMPL) { + return rv; + } } } APR_BRIGADE_CONCAT(*saveto, *b); - return APR_SUCCESS; + return srv; } AP_DECLARE_NONSTD(apr_status_t) ap_filter_flush(apr_bucket_brigade *bb,