summaryrefslogtreecommitdiffstats
path: root/server/connection.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:27 +0000
commitc54018b07a9085c0a3aedbc2bd01a85a3b3e20cf (patch)
treef6e1d6fcf9f6db3794c418b2f89ecf9e08ff41c8 /server/connection.c
parentAdding debian version 2.4.38-3+deb10u10. (diff)
downloadapache2-c54018b07a9085c0a3aedbc2bd01a85a3b3e20cf.tar.xz
apache2-c54018b07a9085c0a3aedbc2bd01a85a3b3e20cf.zip
Merging upstream version 2.4.59.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'server/connection.c')
-rw-r--r--server/connection.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/server/connection.c b/server/connection.c
index 1974537..bbc94c4 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -122,9 +122,7 @@ AP_DECLARE(int) ap_start_lingering_close(conn_rec *c)
{
apr_socket_t *csd = ap_get_conn_socket(c);
- if (!csd) {
- return 1;
- }
+ ap_assert(csd != NULL);
if (ap_prep_lingering_close(c)) {
return 1;
@@ -139,18 +137,12 @@ AP_DECLARE(int) ap_start_lingering_close(conn_rec *c)
ap_flush_conn(c);
#ifdef NO_LINGCLOSE
- apr_socket_close(csd);
return 1;
#else
/* Shut down the socket for write, which will send a FIN
* to the peer.
*/
- if (c->aborted
- || apr_socket_shutdown(csd, APR_SHUTDOWN_WRITE) != APR_SUCCESS) {
- apr_socket_close(csd);
- return 1;
- }
- return 0;
+ return (c->aborted || apr_socket_shutdown(csd, APR_SHUTDOWN_WRITE));
#endif
}
@@ -161,7 +153,17 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
apr_time_t now, timeup = 0;
apr_socket_t *csd = ap_get_conn_socket(c);
+ if (!csd) {
+ /* Be safe with third-party modules that:
+ * ap_set_core_module_config(c->conn_config, NULL)
+ * to no-op ap_lingering_close().
+ */
+ c->aborted = 1;
+ return;
+ }
+
if (ap_start_lingering_close(c)) {
+ apr_socket_close(csd);
return;
}
@@ -207,13 +209,9 @@ AP_DECLARE(void) ap_lingering_close(conn_rec *c)
AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c, void *csd)
{
- int rc;
ap_update_vhost_given_ip(c);
- rc = ap_run_pre_connection(c, csd);
- if (rc != OK && rc != DONE) {
- c->aborted = 1;
- }
+ ap_pre_connection(c, csd);
if (!c->aborted) {
ap_run_process_connection(c);