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 2004/09/26 17:52:52 UTC

cvs commit: httpd-2.0/server util_filter.c

jorton      2004/09/26 08:52:52

  Modified:    modules/generators mod_cgi.c
               server   util_filter.c
  Log:
  * server/util_filter.c (ap_save_brigade): Handle an ENOTIMPL setaside
  function correctly.
  
  * modules/generators/mod_cgi.c (cgi_handler): Revert r1.169,
  unnecessary CGI bucket lifetime kludge.
  
  PR: 31247
  
  Revision  Changes    Path
  1.171     +1 -4      httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.170
  retrieving revision 1.171
  diff -d -w -u -r1.170 -r1.171
  --- mod_cgi.c	22 Sep 2004 15:38:02 -0000	1.170
  +++ mod_cgi.c	26 Sep 2004 15:52:51 -0000	1.171
  @@ -905,10 +905,7 @@
       apr_file_pipe_timeout_set(script_in, 0);
       apr_file_pipe_timeout_set(script_err, 0);
       
  -    /* if r is a subrequest, ensure that the bucket only references
  -     * r->main, since it may last longer than the subreq. */
  -    b = cgi_bucket_create(r->main ? r->main : r, script_in, script_err,
  -                          c->bucket_alloc);
  +    b = cgi_bucket_create(r, script_in, script_err, c->bucket_alloc);
   #else
       b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
   #endif
  
  
  
  1.101     +15 -4     httpd-2.0/server/util_filter.c
  
  Index: util_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_filter.c,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -d -w -u -r1.100 -r1.101
  --- util_filter.c	21 Sep 2004 10:14:40 -0000	1.100
  +++ util_filter.c	26 Sep 2004 15:52:51 -0000	1.101
  @@ -546,10 +546,21 @@
            e = APR_BUCKET_NEXT(e))
       {
           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) {
               return rv;
           }
       }