From: Yann Ylavic Date: Fri, 28 Jan 2022 12:32:25 +0000 (+0000) Subject: mod_cgi[d]: Close the connection after handling nph- scripts. X-Git-Tag: 2.5.0-alpha2-ci-test-only~533 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b36b129f346ccf191069b5117d631a77a4b74502;p=thirdparty%2Fapache%2Fhttpd.git mod_cgi[d]: Close the connection after handling nph- scripts. 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 --- diff --git a/modules/generators/cgi_common.h b/modules/generators/cgi_common.h index 69df73ce68f..7aaf9b2793d 100644 --- a/modules/generators/cgi_common.h +++ b/modules/generators/cgi_common.h @@ -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); }