Commit 27b79e40 authored by Joe Orton's avatar Joe Orton
Browse files

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
parent c3f80aa8
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGES: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
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
+0 −5
Changes for STATUS: 0 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -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
+22 −6
Changes for server/util_filter.c: 22 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -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) {

        /* 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,