You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Geoffrey Young <ge...@modperlcookbook.org> on 2004/02/25 21:15:35 UTC
$r->proxyreq() with no args
stas and I were having an offline discussion about the logic behind the
no-args logic in $r->proxyreq(), specifically this part (from
Apache__RequestRec.h)
if (!val && !r->proxyreq &&
r->parsed_uri.scheme &&
!(r->parsed_uri.hostname &&
strEQ(r->parsed_uri.scheme, ap_http_method(r)) &&
ap_matches_request_vhost(r, r->parsed_uri.hostname,
r->parsed_uri.port_str ?
r->parsed_uri.port :
ap_default_port(r))))
{
retval = r->proxyreq = 1;
r->uri = r->unparsed_uri;
/* else mod_proxy will segfault */
r->filename = apr_pstrcat(r->pool, "modperl-proxy:", r->uri, NULL);
}
after giving it lots of thought and analysis I think this ought to be
removed entirely. here's my reasoning:
- this code duplicates mod_proxy's proxy_request() routine
- proxy_request() runs in a post-read-request handler, meaning that if
mod_proxy is installed and activated the code can't help but run, even if
you add the logic yourself from mod_perl.
- if you don't have mod_proxy installed or activated, this code doesn't
help you, since there is no content handler around to serve the proxy
(unless you write one).
basically, all this code provides is a duplication of the mod_proxy logic
that is useful only if you go through the trouble of writing a proxying
content handler as well - essentially this offers a shortcut to only one
aspect of a much larger task.
it looks as though this code always runs in mp1. here's the history:
http://marc.theaimsgroup.com/?l=apache-modperl&m=90221051626217&w=2
for mp2 I think the underlying assertion is wrong - mod_perl should not be
detecting proxies on its own. apparently somebody (doug?) agreed and the
logic was moved from 'always run' in mp1 to 'run on demand' in mp2.
I see no reason to keep the 'run on demand' logic in $r->proxyreq() at all.
if you want to go through the pain of writing your own proxy from scratch
(instead of using mod_proxy) then you have all the API bits available via
the mp2 API to get the job done yourself - there is no reason mod_perl needs
to support a simplified version of proxy_detect() that I can see.
so, unless someone can convince me differently, I'm going to strip away this
logic and shift $r->proxyreq() back into an autogenerated accessor/mutator,
probably toward the end of the week.
so, speak up :)
--Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: $r->proxyreq() with no args
Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>>after giving it lots of thought and analysis I think this ought to be
>>removed entirely.
>
>
>>if you want to go through the pain of writing your own proxy from scratch
>>(instead of using mod_proxy) then you have all the API bits available via
>>the mp2 API to get the job done yourself
>
>
> I guess not quite enough thought after all :)
>
> the API still lacks access to ap_matches_request_vhost. so, after all that
> windblowing, maybe we ought to keep it after all until we figure out a way
> to open that API up...
So may be we should not advertise the special behavior proxyreq() provides. Or
add a note that it's a subject to change? (talking API freeze here).
> eesh... talk about eating your words :)
well, at least put it on the todo list with a reference to this thread, so in
the future you won't have to dig up the story.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: $r->proxyreq() with no args
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> after giving it lots of thought and analysis I think this ought to be
> removed entirely.
> if you want to go through the pain of writing your own proxy from scratch
> (instead of using mod_proxy) then you have all the API bits available via
> the mp2 API to get the job done yourself
I guess not quite enough thought after all :)
the API still lacks access to ap_matches_request_vhost. so, after all that
windblowing, maybe we ought to keep it after all until we figure out a way
to open that API up...
eesh... talk about eating your words :)
--Geoff
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org