You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/01/20 10:33:05 UTC

svn commit: r125745 - /httpd/httpd/branches/2.0.x/CHANGES /httpd/httpd/branches/2.0.x/STATUS /httpd/httpd/branches/2.0.x/server/util_filter.c

Author: jorton
Date: Thu Jan 20 01:33:02 2005
New Revision: 125745

URL: http://svn.apache.org/viewcvs?view=rev&rev=125745
Log:
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

Modified:
   httpd/httpd/branches/2.0.x/CHANGES
   httpd/httpd/branches/2.0.x/STATUS
   httpd/httpd/branches/2.0.x/server/util_filter.c

Modified: httpd/httpd/branches/2.0.x/CHANGES
Url: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/CHANGES?view=diff&rev=125745&p1=httpd/httpd/branches/2.0.x/CHANGES&r1=125744&p2=httpd/httpd/branches/2.0.x/CHANGES&r2=125745
==============================================================================
--- httpd/httpd/branches/2.0.x/CHANGES	(original)
+++ httpd/httpd/branches/2.0.x/CHANGES	Thu Jan 20 01:33:02 2005
@@ -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

Modified: httpd/httpd/branches/2.0.x/STATUS
Url: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/STATUS?view=diff&rev=125745&p1=httpd/httpd/branches/2.0.x/STATUS&r1=125744&p2=httpd/httpd/branches/2.0.x/STATUS&r2=125745
==============================================================================
--- httpd/httpd/branches/2.0.x/STATUS	(original)
+++ httpd/httpd/branches/2.0.x/STATUS	Thu Jan 20 01:33:02 2005
@@ -178,11 +178,6 @@
        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

Modified: httpd/httpd/branches/2.0.x/server/util_filter.c
Url: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/server/util_filter.c?view=diff&rev=125745&p1=httpd/httpd/branches/2.0.x/server/util_filter.c&r1=125744&p2=httpd/httpd/branches/2.0.x/server/util_filter.c&r2=125745
==============================================================================
--- httpd/httpd/branches/2.0.x/server/util_filter.c	(original)
+++ httpd/httpd/branches/2.0.x/server/util_filter.c	Thu Jan 20 01:33:02 2005
@@ -518,7 +518,7 @@
                                          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 @@
     
     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,