Ack, I'm so sorry for not including the attachment.  Further
complicating the issue, for some reason, emails from this
list are getting eaten or delayed by my company's server and
so I didn't even see the responses to my original mail until
now, a week later. :(

(I've always felt that email clients should scan any outgoing
emails that contain the word 'attached' yet don't actually
have an attachment and pester the user with a popup saying
"Hey idiot, did you mean to attach something to this email?")

Yes, this patch is purely for 2.0.63; I have not had a chance
to try mod_proxy's new timeout features in the 2.2 line yet,
let alone determine how to apply my fix to it if needed.  I
did look over the new code and it's changed quite a bit.

I did though receive one direct response to my email for someone
else who's has a similar concern for the 2.0 line and so I'm
correctly attaching and sending this patch now and hope that
some others find it useful.

Ron

On Wed, 2008-02-06 at 10:34 -0500, Jim Jagielski wrote:
> On Feb 5, 2008, at 2:52 PM, Ronald Park wrote:
> >
> > Attached is my patch to 2.0.63 to the proxy_http.c file in
> > modules/proxy.
> >
> 
> I didn't see any attached patch... :/
> 
> In any case, the normal process is patch applied to
> trunk with then backport proposals to 2.2 and 2.0. A feature
> added to 2.0.x, without it being in 2.2 and trunk is likely
> not gonna happen.
> 
--- modules/proxy/proxy_http.c.orig	2007-09-04 15:33:45.000000000 -0400
+++ modules/proxy/proxy_http.c	2008-02-04 14:57:21.000000000 -0500
@@ -379,6 +379,36 @@
                          "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.)
+            const char* tbl_timeout;
+            apr_interval_time_t timeout = (conf->timeout_set) ?
+                                           conf->timeout : 0;
+
+            tbl_timeout = apr_table_get(r->subprocess_env, "proxy-timeout");
+            if (tbl_timeout == NULL) {
+                tbl_timeout = apr_table_get(r->notes, "proxy-timeout");
+            }
+            if (tbl_timeout != NULL) {
+                int int_timeout = atoi(tbl_timeout);
+                if (int_timeout > 0) {
+                  timeout = apr_time_from_sec(int_timeout);
+                }
+            }
+            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;

Reply via email to