You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Peter Jones <pj...@pmade.org> on 2003/01/08 20:35:15 UTC

getsfunc_BRIGADE tries to split a pipe bucket

I am trying to trace a problem between mod_cgid and mod_cache. Sorry if
this seems like a request for support, but this is too technical for
other lists.

In 2.0.43 mod_cgid will use apr_bucket_pipe_create so that it can call
ap_scan_script_header_err_brigade to remove the script headers from the
output and place them into r->headers_out.

ap_scan_script_header_err_brigade is just a call to
ap_scan_script_header_err_core with getsfunc_BRIGADE. This function
tries to act like gets(), and therefore must split the bucket after each
newline.

The problem is, the bucket is a pipe, and from what I can tell, you can
split pipe buckets.

I got this far because mod_cache won't cache the output of my CGI
script. It turns out that when it reads the bucket to place the output
in the cache (mod_mem_cache) the bucket contains the script headers.
This cause the buffer overflow check to fail, and thus the caching to
fail.

Am I missing something here? I must be because the script output looks
good (the body does not contain the headers), but it shows up in
mod_cache.

BTW, I made CACHE_IN run as AP_FTYPE_CONTENT_SET+20 so that it would run
as late as possible.

-- 
Peter Jones <jesus;unix;c++;crypto;vi;4wd;geek> [ http://pmade.org ]
PGP Fingerprint: 27AD 7922 D3BC 46A3 3627 D7B4 4240 46C3 A41E 844A

Re: [PATCH] getsfunc_BRIGADE tries to split a pipe bucket

Posted by Peter Jones <pj...@pmade.org>.
Hey, remember back when Peter Jones said:
> Is there a reason that ap_scan_script_header_err_core can't put the
> Expires header in r->headers_out? Want me to send in a patch?

--- server/util_script.c.orig	Wed Jan  8 13:33:47 2003
+++ server/util_script.c	Wed Jan  8 13:33:47 2003
@@ -591,6 +591,9 @@
 	else if (!strcasecmp(w, "Transfer-Encoding")) {
 	    apr_table_set(r->headers_out, w, l);
 	}
+	else if (!strcasecmp(w, "Expires")) {
+	    apr_table_set(r->headers_out, w, l);
+	}
 	/*
 	 * If the script gave us a Last-Modified header, we can't just
 	 * pass it on blindly because of restrictions on future values.

-- 
Peter Jones <jesus;unix;c++;crypto;vi;4wd;geek> [ http://pmade.org ]
PGP Fingerprint: 27AD 7922 D3BC 46A3 3627 D7B4 4240 46C3 A41E 844A

Re: getsfunc_BRIGADE tries to split a pipe bucket

Posted by Peter Jones <pj...@pmade.org>.
Hey, remember back when Peter Jones said:
> BTW, I made CACHE_IN run as AP_FTYPE_CONTENT_SET+20 so that it would run
> as late as possible.

Okay, I shot myself in the foot when I had CACHE_IN registered as
AP_FTYPE_CONTENT_SET+20, stupid me. It was running after http_header and
that is why it saw the headers.

I kept digging around for why mod_cache won't cache my CGI script. It
turns out that ap_scan_script_header_err_core puts the Expires header in
r->err_headers_out. Because of this, mod_cache can't see it and refuses
to cache the output.

Is there a reason that ap_scan_script_header_err_core can't put the
Expires header in r->headers_out? Want me to send in a patch?

-- 
Peter Jones <jesus;unix;c++;crypto;vi;4wd;geek> [ http://pmade.org ]
PGP Fingerprint: 27AD 7922 D3BC 46A3 3627 D7B4 4240 46C3 A41E 844A