You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stefan Fritsch <sf...@sfritsch.de> on 2010/03/09 22:20:59 UTC

mod_reqtimeout and mod_proxy: how to distinguish incoming from backend connections

Hi,

mod_proxy calls ap_run_pre_connection() on the backend connection, 
which causes mod_reqtimeout to be inserted as filter. This is of 
course wrong, because mod_reqtimeout will mess up mod_proxy's socket 
timeouts.

After digging in the code I have found two potential solutions:

- The scoreboard handle conn->sbh is always NULL in mod_proxy's 
backend connection. Mod_reqtimeout could use this to determine if it 
should do something.

- mod_reqtimeout could hook into ap_run_process_connection with 
APR_HOOK_LAST or APR_HOOK_REALLY_LAST-1, i.e. right before 
ap_process_http_connection(). The hook function would then set a flag 
to activate mod_reqtimeout and then return DECLINED. This should lead 
to mod_reqtimeout only dealing with connections handled by 
ap_process_http_connection.


Both approaches are rather hack-ish but I think the second one is a 
lot better than the first. It would also prevent mod_reqtimeout from 
influencing protocol handlers like mod_echo and mod_ftp.

Does anyone have other ideas or comments?


BTW, can someone create a mod_reqtimeout entry in bugzilla?

Cheers,
Stefan

RE: mod_reqtimeout and mod_proxy: how to distinguish incoming from backend connections

Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
 

> -----Original Message-----
> From: Stefan Fritsch 
> Sent: Dienstag, 9. März 2010 22:21
> To: dev@httpd.apache.org
> Subject: mod_reqtimeout and mod_proxy: how to distinguish 
> incoming from backend connections
> 
> Hi,
> 
> mod_proxy calls ap_run_pre_connection() on the backend connection, 
> which causes mod_reqtimeout to be inserted as filter. This is of 
> course wrong, because mod_reqtimeout will mess up mod_proxy's socket 
> timeouts.
> 
> After digging in the code I have found two potential solutions:
> 
> - The scoreboard handle conn->sbh is always NULL in mod_proxy's 
> backend connection. Mod_reqtimeout could use this to determine if it 
> should do something.
> 
> - mod_reqtimeout could hook into ap_run_process_connection with 
> APR_HOOK_LAST or APR_HOOK_REALLY_LAST-1, i.e. right before 
> ap_process_http_connection(). The hook function would then set a flag 
> to activate mod_reqtimeout and then return DECLINED. This should lead 
> to mod_reqtimeout only dealing with connections handled by 
> ap_process_http_connection.
> 
> 
> Both approaches are rather hack-ish but I think the second one is a 
> lot better than the first. It would also prevent mod_reqtimeout from 
> influencing protocol handlers like mod_echo and mod_ftp.
> 
> Does anyone have other ideas or comments?

Sounds reasonable.

Regards

Rüdiger


Re: mod_reqtimeout and mod_proxy: how to distinguish incoming from backend connections

Posted by Rainer Jung <ra...@kippdata.de>.
Hi Stefan,

On 09.03.2010 22:20, Stefan Fritsch wrote:
> BTW, can someone create a mod_reqtimeout entry in bugzilla?

Done.