Hi,

the keep-alive timeout applied for sync MPMs (worker, prefork, 2.2.x)
is currently c->base_server->keep_alive_timeout, which implies this
"oddity" in the manual :

- docs/2.2/mod/core.html#keepalivetimeout: "In a name-based virtual
host context, the value of the first defined virtual host (the default
host) in a set of NameVirtualHost will be used. The other values will
be ignored."

- docs/2.4/mod/core.html#keepalivetimeout: "In a name-based virtual
host context, the value of the first defined virtual host best
matching the local IP and port will be used."

This makes it quite unusable in a named based virtual host context
(but for the first vhost).

I propose to simply :

Index: modules/http/http_core.c
===================================================================
--- modules/http/http_core.c    (revision 1663701)
+++ modules/http/http_core.c    (working copy)
@@ -179,6 +179,8 @@ static int ap_process_http_sync_connection(conn_re

     ap_update_child_status_from_conn(c->sbh, SERVER_BUSY_READ, c);
     while ((r = ap_read_request(c)) != NULL) {
+        apr_interval_time_t keep_alive_timeout =
+                                r->server->keep_alive_timeout;

         c->keepalive = AP_CONN_UNKNOWN;
         /* process the request if it was read without error */
@@ -215,7 +217,7 @@ static int ap_process_http_sync_connection(conn_re
             csd = ap_get_conn_socket(c);
         }
         apr_socket_opt_set(csd, APR_INCOMPLETE_READ, 1);
-        apr_socket_timeout_set(csd, c->base_server->keep_alive_timeout);
+        apr_socket_timeout_set(csd, keep_alive_timeout);
         /* Go straight to select() to wait for the next request */
     }
--
so that it works in any vhost.

I addressed this in mpm_event (async) with a different/event specific
patch in PR56226.
So the patch above would make things consistent with all MPMs.

Thoughts, objections?

Regards,
Yann.

Reply via email to