summaryrefslogtreecommitdiffstats
path: root/server/connection.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:26 +0000
commit7b31d4f4901cdb89a79f2f7de4a6b8bb637b523b (patch)
treefdeb0b5ff80273f95ce61607fc3613dff0b9a235 /server/connection.c
parentAdding upstream version 2.4.38. (diff)
downloadapache2-upstream.tar.xz
apache2-upstream.zip
Adding upstream version 2.4.59.upstream/2.4.59upstream
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);