From: Justin Erenkrantz Date: Wed, 10 Aug 2005 04:32:13 +0000 (+0000) Subject: Fix bug where non-200 CGI responses will not send anything down filter chain. X-Git-Tag: 2.1.7~5^2~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b005585dfbeadf4c99c47778133699522e9cd2e;p=thirdparty%2Fapache%2Fhttpd.git Fix bug where non-200 CGI responses will not send anything down filter chain. This is most notable when mod_cache is used. This has been used in production on wiki.apache.org for a while now. * modules/generators/mod_cgi.c (cgi_handler): When a non-zero value is returned by scan_script, set the status field and ensure that we have an EOS to send down the filer stack. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@231167 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 4bac9c3d476..463f0763595 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -929,7 +929,18 @@ static int cgi_handler(request_rec *r) int ret; if ((ret = ap_scan_script_header_err_brigade(r, bb, sbuf))) { - return log_script(r, conf, ret, dbuf, sbuf, bb, script_err); + ret = log_script(r, conf, ret, dbuf, sbuf, bb, script_err); + + /* Set our status. */ + r->status = ret; + + /* Pass EOS bucket down the filter chain. */ + apr_brigade_cleanup(bb); + b = apr_bucket_eos_create(c->bucket_alloc); + APR_BRIGADE_INSERT_TAIL(bb, b); + ap_pass_brigade(r->output_filters, bb); + + return ret; } location = apr_table_get(r->headers_out, "Location");