From: Joe Orton Date: Wed, 5 May 2004 15:30:53 +0000 (+0000) Subject: * modules/generators/mod_cgi.c (cgi_handler): Soak up stderr from nph- X-Git-Tag: pre_ajp_proxy~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0df6a7dbfe5e13992a5686033b21fe27c09dd67e;p=apache * modules/generators/mod_cgi.c (cgi_handler): Soak up stderr from nph- scripts correctly. PR: 18348 Submitted by: Jeff Trawick (in mod_jcgi) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103622 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 8df27970f6..255878bb6f 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -942,19 +942,6 @@ static int cgi_handler(request_rec *r) } rv = ap_pass_brigade(r->output_filters, bb); - - /* don't soak up script output if errors occurred - * writing it out... otherwise, we prolong the - * life of the script when the connection drops - * or we stopped sending output for some other - * reason - */ - if (rv == APR_SUCCESS && !r->connection->aborted) { - apr_file_pipe_timeout_set(script_err, r->server->timeout); - log_script_err(r, script_err); - } - - apr_file_close(script_err); } else /* nph */ { struct ap_filter_t *cur; @@ -970,8 +957,19 @@ static int cgi_handler(request_rec *r) } r->output_filters = r->proto_output_filters = cur; - ap_pass_brigade(r->output_filters, bb); + rv = ap_pass_brigade(r->output_filters, bb); + } + + /* don't soak up script output if errors occurred writing it + * out... otherwise, we prolong the life of the script when the + * connection drops or we stopped sending output for some other + * reason */ + if (rv == APR_SUCCESS && !r->connection->aborted) { + apr_file_pipe_timeout_set(script_err, r->server->timeout); + log_script_err(r, script_err); } + + apr_file_close(script_err); return OK; /* NOT r->status, even if it has changed. */ }