1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

mod_proxy: Shutdown (eg. SSL close notify) the backend connection

before closing.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1601291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2014-06-09 01:03:39 +00:00
parent bac2d32f4c
commit 5cc5869ea4
3 changed files with 37 additions and 1 deletions

View File

@@ -1,6 +1,9 @@
-*- coding: utf-8 -*- -*- coding: utf-8 -*-
Changes with Apache 2.5.0 Changes with Apache 2.5.0
*) mod_proxy: Shutdown (eg. close notify) the backend connection before
closing. [Yann Ylavic]
*) mpm_event[opt]: Send the SSL close notify alert when the KeepAliveTimeout *) mpm_event[opt]: Send the SSL close notify alert when the KeepAliveTimeout
expires. PR54998. [Yann Ylavic] expires. PR54998. [Yann Ylavic]

View File

@@ -1 +1 @@
2642 2643

View File

@@ -2815,6 +2815,33 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
return connected ? OK : DECLINED; return connected ? OK : DECLINED;
} }
static apr_status_t connection_shutdown(void *theconn)
{
proxy_conn_rec *conn = (proxy_conn_rec *)theconn;
conn_rec *c = conn->connection;
if (c) {
if (!c->aborted) {
apr_interval_time_t saved_timeout = 0;
apr_socket_timeout_get(conn->sock, &saved_timeout);
if (saved_timeout) {
apr_socket_timeout_set(conn->sock, 0);
}
(void)ap_shutdown_conn(c, 0);
c->aborted = 1;
if (saved_timeout) {
apr_socket_timeout_set(conn->sock, saved_timeout);
}
}
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, c, APLOGNO(02642)
"proxy: connection shutdown");
}
return APR_SUCCESS;
}
PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function, PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
proxy_conn_rec *conn, proxy_conn_rec *conn,
conn_rec *c, conn_rec *c,
@@ -2887,6 +2914,12 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
} }
apr_socket_timeout_set(conn->sock, current_timeout); apr_socket_timeout_set(conn->sock, current_timeout);
/* Shutdown the connection before closing it (eg. SSL connections
* need to be close-notify-ed).
*/
apr_pool_cleanup_register(conn->scpool, conn, connection_shutdown,
apr_pool_cleanup_null);
return OK; return OK;
} }