From 7e2a5490d174a33c3da70db17bc5d4e5a7a22cf9 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Thu, 6 Oct 2005 01:29:42 +0000 Subject: NET_TIME, as a standalone feature, was a horrid idea. The core filter will NOT operate correctly across platforms (even between Linux/Solaris) without setting up the conn->timeout, so always apply the timeout when establishing the core filter. The keep-alive-timeout is entirely an HTTP-ism, and needs to move to the http protocol handler. Note #1; this isn't triggered in the event mpm, but the event mpm introspects s->keep_alive_timeout directly adding it to the pollset, so this is a non-sequitor. Finally, once the headers are read, the named virtual host may have a different (more/less permissive) timeout for the remainder of the request body. This http-centric patch picks up that subtle detail and can switch to a named-vhost timeout. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@306495 13f79535-47bb-0310-9956-ffa450edef68 --- server/protocol.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'server/protocol.c') diff --git a/server/protocol.c b/server/protocol.c index 327adb63b8..e440ced174 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -832,6 +832,8 @@ request_rec *ap_read_request(conn_rec *conn) const char *expect; int access_status; apr_bucket_brigade *tmp_bb; + apr_socket_t *csd; + apr_interval_time_t cur_timeout; apr_pool_create(&p, conn->pool); apr_pool_tag(p, "request"); @@ -892,6 +894,17 @@ request_rec *ap_read_request(conn_rec *conn) return NULL; } + /* We may have been in keep_alive_timeout mode, so toggle back + * to the normal timeout mode as we fetch the header lines, + * as necessary. + */ + csd = ap_get_module_config(conn->conn_config, &core_module); + apr_socket_timeout_get(csd, &cur_timeout); + if (cur_timeout != conn->base_server->timeout) { + apr_socket_timeout_set(csd, conn->base_server->timeout); + cur_timeout = conn->base_server->timeout; + } + if (!r->assbackwards) { ap_get_mime_headers_core(r, tmp_bb); if (r->status != HTTP_REQUEST_TIME_OUT) { @@ -942,6 +955,14 @@ request_rec *ap_read_request(conn_rec *conn) */ ap_update_vhost_from_headers(r); + /* Toggle to the Host:-based vhost's timeout mode to fetch the + * request body and send the response body, if needed. + */ + if (cur_timeout != r->server->timeout) { + apr_socket_timeout_set(csd, r->server->timeout); + cur_timeout = r->server->timeout; + } + /* we may have switched to another server */ r->per_dir_config = r->server->lookup_defaults; -- cgit v1.2.3