]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_cgi[d]: Close the connection after handling nph- scripts.
authorYann Ylavic <ylavic@apache.org>
Fri, 28 Jan 2022 12:32:25 +0000 (12:32 +0000)
committerYann Ylavic <ylavic@apache.org>
Fri, 28 Jan 2022 12:32:25 +0000 (12:32 +0000)
The HTTP output filters chain is bypassed for nph- scripts (whatever this
means), so there is no way to know whether the connection is reusable after
sending the cgi response (opaque header + body).

Set r->connection->keepalive = AP_CONN_CLOSE unconditionally.

For instance test frameork's "nph-foldhdr.pl" script responds with HTTP/1.0
and no Content-Length so closing the connection is the only way to detect the
end of response for the peer.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897563 13f79535-47bb-0310-9956-ffa450edef68

modules/generators/cgi_common.h

index 69df73ce68facdcf2eb20f394b85a99a360d7152..7aaf9b2793daaac5964829a2f707ec436b467214 100644 (file)
@@ -524,6 +524,9 @@ static int cgi_handle_response(request_rec *r, int nph, apr_bucket_brigade *bb,
         }
         r->output_filters = r->proto_output_filters = cur;
 
+        /* Dunno about the reusability of the connection either, so don't */
+        r->connection->keepalive = AP_CONN_CLOSE;
+
         rv = ap_pass_brigade(r->output_filters, bb);
     }