From: Jeff Trawick Date: Thu, 31 Oct 2002 11:53:43 +0000 (+0000) Subject: Terminate CGI scripts when the client connection drops. This X-Git-Tag: 2.0.44~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c584036fd813de574f4a855a28376b477c44ee2;p=thirdparty%2Fapache%2Fhttpd.git Terminate CGI scripts when the client connection drops. This fix only applies to some normal paths in mod_cgi. mod_cgid is still busted. A prereq for this fix is the change to content-length filter to notice c->aborted: http://cvs.apache.org/viewcvs.cgi/httpd-2.0/server/protoc ol.c.diff?r1=1.119&r2=1.120&diff_format=h PR: 8388 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97364 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 3021df41e90..384f801ed22 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.44 - + + *) Terminate CGI scripts when the client connection drops. This + fix only applies to some normal paths in mod_cgi. mod_cgid + is still busted. PR 8388 [Jeff Trawick] + *) Fix a bug where 416 "Range not satisfiable" was being returned for content that should have been redirected. [Greg Ames] diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 2e0b360cd08..c46692b37f5 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -785,9 +785,18 @@ static int cgi_handler(request_rec *r) return HTTP_MOVED_TEMPORARILY; } - 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) { + log_script_err(r, script_err); + } - log_script_err(r, script_err); apr_file_close(script_err); }