On Tue, 16 Mar 2010, Ruediger Pluem wrote:

On 15.03.2010 21:46, [email protected] wrote:
Author: sf
Date: Mon Mar 15 20:46:26 2010
New Revision: 923429

URL: http://svn.apache.org/viewvc?rev=923429&view=rev
Log:
get the socket with ap_get_module_config instead of walking the filter chain

Modified:
    httpd/httpd/trunk/modules/filters/mod_reqtimeout.c

Modified: httpd/httpd/trunk/modules/filters/mod_reqtimeout.c
URL: 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_reqtimeout.c?rev=923429&r1=923428&r2=923429&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/filters/mod_reqtimeout.c (original)
+++ httpd/httpd/trunk/modules/filters/mod_reqtimeout.c Mon Mar 15 20:46:26 2010
@@ -151,21 +151,7 @@ static apr_status_t reqtimeout_filter(ap
     }

     if (!ccfg->socket) {
-        core_net_rec *net_rec;
-        ap_filter_t *core_in = f->next;
-
-        while (core_in && core_in->frec != ap_core_input_filter_handle)
-            core_in = core_in->next;
-
-        if (!core_in) {
-            ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, f->c,
-                          "mod_reqtimeout: Can't get socket "
-                          "handle from core_input_filter");
-            ap_remove_input_filter(f);
-            return ap_get_brigade(f->next, bb, mode, block, readbytes);
-        }
-        net_rec = core_in->ctx;
-        ccfg->socket = net_rec->client_socket;
+        ccfg->socket = ap_get_module_config(f->c->conn_config, &core_module);

Not quite sure if this data structure is part of the API. If not the core could
change it anytime and the above assignment could fail then.

Other modules do the same, so mod_reqtimeout does not create an additional problem IMHO:

$ grep -rl ap_get_module_config.*conn_config.*core_module modules
modules/proxy/mod_proxy_connect.c
modules/proxy/mod_proxy_fdpass.c
modules/filters/mod_reqtimeout.c
modules/http/http_core.c
modules/echo/mod_echo.c
modules/experimental/mod_noloris.c

Reply via email to