perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: [mp2] map to storage handler
Date Tue, 08 Jun 2004 18:53:23 GMT

> 3) and there is ap_send_http_trace in http_protocol.c, registered as:
> ap_hook_map_to_storage(ap_send_http_trace,NULL,NULL,APR_HOOK_MIDDLE);
> 
> 
> 
> So we have a problem here. If one uses PerlMapToStorageHandler to
> shortcut the uri2file translation, and returns OK, TRACE calls will be
> not handled at all. since at the moment mod_perl runs its handler before
> ap_send_http_trace had a chance to run.

that's right - if you are implementing a PerlMapToStorageHandler then you
are in charge of handling all the logic that is required of core if you
return OK.  this is exactly the same as it used to be with the
PerlTransHandler - return OK and you better be sure that you set
$r->filename to the real file or else things wont work as expected.

> 
> Of course one could start their PerlMapToStorageHandler with:
> 
>   if ($r->method_number != Apache::M_TRACE) {
>       return Apache::DECLINED;
>   }
> 
> as a workaround, but this sounds ugly.

but required if you want to handle TRACE requests (which are even more rare
than HEAD :)  for an example of overriding core map_to_storage see mod_proxy.

> May be registering that hook on
> the mod_perl side as APR_HOOK_LAST is a better idea? But how can we be
> sure that tomorrow Apache won't have some other callback in the middle
> that we may not want to run?

you can't do that - HOOK_RUN_FIRST means that httpd core would always return
OK and prevent the mod_perl callback from running.

--Geoff


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message