]> granicus.if.org Git - apache/commitdiff
Terminate CGI scripts when the client connection drops. This
authorJeff Trawick <trawick@apache.org>
Thu, 31 Oct 2002 11:53:43 +0000 (11:53 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 31 Oct 2002 11:53:43 +0000 (11:53 +0000)
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

CHANGES
modules/generators/mod_cgi.c

diff --git a/CHANGES b/CHANGES
index 3021df41e90a9aac869f3e1774e906892d1df600..384f801ed2274a6cfbe1b48704e72c3e6d04d30e 100644 (file)
--- 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]
index 2e0b360cd082a46b6ed3b002065a9d0ee0ff31e9..c46692b37f55cd307676c1969ef5a1cf900ba983 100644 (file)
@@ -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);
     }