diff options
Diffstat (limited to 'server/connection.c')
-rw-r--r-- | server/connection.c | 28 |
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); |