]> granicus.if.org Git - apache/commitdiff
* modules/generators/mod_cgi.c (cgi_handler): Soak up stderr from nph-
authorJoe Orton <jorton@apache.org>
Wed, 5 May 2004 15:30:53 +0000 (15:30 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 5 May 2004 15:30:53 +0000 (15:30 +0000)
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

modules/generators/mod_cgi.c

index 8df27970f6d8460c82daa391154bdfbd69eca319..255878bb6f38dab23c337abfd4e0d2d6afc80a28 100644 (file)
@@ -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. */
 }