From 6d70c8112e601c0a709e28c74c53ccaa38b73d1b Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Wed, 4 Nov 2020 00:32:50 +0000 Subject: [PATCH] mpm_event: don't reset connections after lingering close timeout While httpd is supposed to do lingering close for incoming data, it has no control anyway over outgoing/pending data once they are handled by the system. So don't reset the connection after lingering close times out, otherwise the system won't do its own lingering close to flush un-acked data. The connection reset was introduced by r1802875 and backported to 2.4.28. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1883097 13f79535-47bb-0310-9956-ffa450edef68 --- changes-entries/event_abort_socket_no_reset.txt | 3 +++ server/mpm/event/event.c | 15 --------------- 2 files changed, 3 insertions(+), 15 deletions(-) create mode 100644 changes-entries/event_abort_socket_no_reset.txt diff --git a/changes-entries/event_abort_socket_no_reset.txt b/changes-entries/event_abort_socket_no_reset.txt new file mode 100644 index 00000000000..d26357eef51 --- /dev/null +++ b/changes-entries/event_abort_socket_no_reset.txt @@ -0,0 +1,3 @@ + *) mpm_event: don't reset connections after lingering close, restoring prior + to 2.4.28 behaviour. [Yann Ylavic] + diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index bcd711323cd..dbfe65c513d 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -558,21 +558,6 @@ static void abort_socket_nonblocking(apr_socket_t *csd) { apr_status_t rv; apr_socket_timeout_set(csd, 0); -#if defined(SOL_SOCKET) && defined(SO_LINGER) - /* This socket is over now, and we don't want to block nor linger - * anymore, so reset it. A normal close could still linger in the - * system, while RST is fast, nonblocking, and what the peer will - * get if it sends us further data anyway. - */ - { - apr_os_sock_t osd = -1; - struct linger opt; - opt.l_onoff = 1; - opt.l_linger = 0; /* zero timeout is RST */ - apr_os_sock_get(&osd, csd); - setsockopt(osd, SOL_SOCKET, SO_LINGER, (void *)&opt, sizeof opt); - } -#endif rv = apr_socket_close(csd); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf, APLOGNO(00468) -- 2.47.3