Hi Folks,
After fumbling up a previous attempt to send in this patch,
I'm going to try again, making sure to attach the patch this
time. :)
The following patch makes mod_proxy truly use ProxyTimeout
for the actual sending and receiving of the proxied request;
as it's currently implemented, it uses ProxyTimeout when
attempting the connection to the origin server *but* uses
the value of Timeout for sending and receiving the proxied
request.
Since mod_proxy introduced entirely new timeout handling in
2.2, I have not determined if this problem still exists or
is even relevant in that branch. However, I do think the
behavior in the 2.0 line at least does not match the document
for how ProxyTimeout is expected to work:
> This directive allows a user to specifiy a timeout on proxy requests.
> This is useful when you have a slow/buggy appserver which hangs, and
> you would rather just return a timeout and fail gracefully instead of
> waiting however long it takes the server to return.
Thanks,
Ron
--- modules/proxy/proxy_http.c.orig 2007-09-04 15:33:45.000000000 -0400
+++ modules/proxy/proxy_http.c 2008-02-21 14:20:01.000000000 -0500
@@ -379,6 +379,25 @@
"proxy: HTTP: pre_connection setup failed (%d)",
rc);
return rc;
+ } else {
+ // that pre_connection code sets the socket timeout as
+ // the value of Timeout which is the timeout of the
+ // original request; by the time that is hit, our client
+ // has already been given a timeout
+ //
+ // instead, we'll look to see if an env var, proxy-timeout,
+ // has been set: if so, we use it; otherwise, we use
+ // the setting for ProxyTimeout (if set); (otherwise, we
+ // will stick with the value of Timeout.)
+ apr_interval_time_t timeout = (conf->timeout_set) ?
+ conf->timeout : 0;
+
+ if (timeout > 0) {
+ apr_socket_timeout_set(p_conn->sock, timeout);
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy: setting request timeout (%d)", timeout);
+ }
+
}
}
return OK;