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:
@@ -2815,6 +2815,33 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
||||
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_conn_rec *conn,
|
||||
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);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user