mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
*) mod_proxy: Fix KeepAlives not being allowed and set to
backend servers. PR38602. [Ruediger Pluem, Jim Jagielski] Also, document previous patch: *) Correctly initialize mod_proxy workers, which use a combination of local and shared datasets. Adjust logging to better trace usage. PR38403. [Jim Jagielski] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@378032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
7
CHANGES
7
CHANGES
@@ -2,6 +2,13 @@
|
|||||||
Changes with Apache 2.3.0
|
Changes with Apache 2.3.0
|
||||||
[Remove entries to the current 2.0 and 2.2 section below, when backported]
|
[Remove entries to the current 2.0 and 2.2 section below, when backported]
|
||||||
|
|
||||||
|
*) mod_proxy: Fix KeepAlives not being allowed and set to
|
||||||
|
backend servers. PR38602. [Ruediger Pluem, Jim Jagielski]
|
||||||
|
|
||||||
|
*) Correctly initialize mod_proxy workers, which use a
|
||||||
|
combination of local and shared datasets. Adjust logging
|
||||||
|
to better trace usage. PR38403. [Jim Jagielski]
|
||||||
|
|
||||||
*) Respect GracefulShutdownTimeout in the worker and event MPMs.
|
*) Respect GracefulShutdownTimeout in the worker and event MPMs.
|
||||||
[Chris Darroch <chrisd pearsoncmg.com>, Garrett Rooney]
|
[Chris Darroch <chrisd pearsoncmg.com>, Garrett Rooney]
|
||||||
|
|
||||||
|
@@ -981,9 +981,18 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r,
|
|||||||
|
|
||||||
/* Yes I hate gotos. This is the subrequest shortcut */
|
/* Yes I hate gotos. This is the subrequest shortcut */
|
||||||
skip_body:
|
skip_body:
|
||||||
/* Handle Connection: header */
|
/*
|
||||||
if (!force10 && p_conn->close) {
|
* Handle Connection: header if we do HTTP/1.1 request:
|
||||||
buf = apr_pstrdup(p, "Connection: close" CRLF);
|
* If we plan to close the backend connection sent Connection: close
|
||||||
|
* otherwise sent Connection: Keep-Alive.
|
||||||
|
*/
|
||||||
|
if (!force10) {
|
||||||
|
if (p_conn->close) {
|
||||||
|
buf = apr_pstrdup(p, "Connection: close" CRLF);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
buf = apr_pstrdup(p, "Connection: Keep-Alive" CRLF);
|
||||||
|
}
|
||||||
ap_xlate_proto_to_ascii(buf, strlen(buf));
|
ap_xlate_proto_to_ascii(buf, strlen(buf));
|
||||||
e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
|
e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(header_brigade, e);
|
APR_BRIGADE_INSERT_TAIL(header_brigade, e);
|
||||||
@@ -1510,12 +1519,6 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
|
|
||||||
/* found the last brigade? */
|
/* found the last brigade? */
|
||||||
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
|
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
|
||||||
/* if this is the last brigade, cleanup the
|
|
||||||
* backend connection first to prevent the
|
|
||||||
* backend server from hanging around waiting
|
|
||||||
* for a slow client to eat these bytes
|
|
||||||
*/
|
|
||||||
backend->close = 1;
|
|
||||||
/* signal that we must leave */
|
/* signal that we must leave */
|
||||||
finish = TRUE;
|
finish = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1584,18 +1587,7 @@ static
|
|||||||
apr_status_t ap_proxy_http_cleanup(const char *scheme, request_rec *r,
|
apr_status_t ap_proxy_http_cleanup(const char *scheme, request_rec *r,
|
||||||
proxy_conn_rec *backend)
|
proxy_conn_rec *backend)
|
||||||
{
|
{
|
||||||
/* If there are no KeepAlives, or if the connection has been signalled
|
ap_proxy_release_connection(scheme, backend, r->server);
|
||||||
* to close, close the socket and clean up
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* if the connection is < HTTP/1.1, or Connection: close,
|
|
||||||
* we close the socket, otherwise we leave it open for KeepAlive support
|
|
||||||
*/
|
|
||||||
if (backend->close || (r->proto_num < HTTP_VERSION(1,1))) {
|
|
||||||
backend->close_on_recycle = 1;
|
|
||||||
ap_set_module_config(r->connection->conn_config, &proxy_http_module, NULL);
|
|
||||||
ap_proxy_release_connection(scheme, backend, r->server);
|
|
||||||
}
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1673,26 +1665,13 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
"proxy: HTTP: serving URL %s", url);
|
"proxy: HTTP: serving URL %s", url);
|
||||||
|
|
||||||
|
|
||||||
/* only use stored info for top-level pages. Sub requests don't share
|
|
||||||
* in keepalives
|
|
||||||
*/
|
|
||||||
if (!r->main) {
|
|
||||||
backend = (proxy_conn_rec *) ap_get_module_config(c->conn_config,
|
|
||||||
&proxy_http_module);
|
|
||||||
}
|
|
||||||
/* create space for state information */
|
/* create space for state information */
|
||||||
if (!backend) {
|
if ((status = ap_proxy_acquire_connection(proxy_function, &backend,
|
||||||
if ((status = ap_proxy_acquire_connection(proxy_function, &backend,
|
worker, r->server)) != OK)
|
||||||
worker, r->server)) != OK)
|
goto cleanup;
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (!r->main) {
|
|
||||||
ap_set_module_config(c->conn_config, &proxy_http_module, backend);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
backend->is_ssl = is_ssl;
|
backend->is_ssl = is_ssl;
|
||||||
backend->close_on_recycle = 1;
|
|
||||||
|
|
||||||
/* Step One: Determine Who To Connect To */
|
/* Step One: Determine Who To Connect To */
|
||||||
if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend,
|
if ((status = ap_proxy_determine_connection(p, r, conf, worker, backend,
|
||||||
@@ -1732,10 +1711,8 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (backend) {
|
if (backend) {
|
||||||
if (status != OK) {
|
if (status != OK)
|
||||||
backend->close = 1;
|
backend->close = 1;
|
||||||
backend->close_on_recycle = 1;
|
|
||||||
}
|
|
||||||
ap_proxy_http_cleanup(proxy_function, r, backend);
|
ap_proxy_http_cleanup(proxy_function, r, backend);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
|
@@ -1868,16 +1868,6 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
|||||||
conn->hostname = apr_pstrdup(conn->pool, uri->hostname);
|
conn->hostname = apr_pstrdup(conn->pool, uri->hostname);
|
||||||
conn->port = uri->port;
|
conn->port = uri->port;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/*
|
|
||||||
* TODO: add address cache for generic forward proxies.
|
|
||||||
* At least level 0 -> compare with previous hostname:port
|
|
||||||
*/
|
|
||||||
if (r->proxyreq == PROXYREQ_PROXY || r->proxyreq == PROXYREQ_REVERSE ||
|
|
||||||
!worker->is_address_reusable) {
|
|
||||||
/*
|
|
||||||
* TODO: Check if the connection can be reused
|
|
||||||
*/
|
|
||||||
if (conn->connection) {
|
if (conn->connection) {
|
||||||
if (conn->sock) {
|
if (conn->sock) {
|
||||||
apr_socket_close(conn->sock);
|
apr_socket_close(conn->sock);
|
||||||
|
Reference in New Issue
Block a user