You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by John Siracusa <si...@mindspring.com> on 2003/04/14 22:55:24 UTC
How to get the "fragment" portion of a URI from $r
Given a request for:
/foo/bar#blah
It seems that:
$r->uri eq '/foo/bar'
scalar $r->args eq '' (or maybe undef)
But how can I get the "blah" part using $r without trying to do a regex
match on $r->the_request or something equally ugly and inefficient?
I want to do this in a trans handler, where I tuck away the requested values
before (possibly) translating them. Suggestions?
-John
Re: How to get the "fragment" portion of a URI from $r
Posted by Stas Bekman <st...@stason.org>.
John Siracusa wrote:
> On 4/14/03 6:11 PM, Iain Truskett wrote:
>
>>* John Siracusa (siracusa@mindspring.com) [15 Apr 2003 07:06]:
>>
>>[...]
>>
>>>This is troubling...is the fragment only a client-side feature?
>>
>>Yes.
>
>
> Ick. I guess that means it's impossible to redirect someone to a secure
> version of the exact URL that was requested, because I have no way of
> knowing what the fragment part of the URL is! Who designed this protocol
> anyway... ;)
As a workaround you could do:
/foo/bar/blah#blah or /foo/bar?blah#blah
where /foo/bar is the real resource, of course you will have to modify your
HTML to have the #fragment also included at the end of the url.
__________________________________________________________________
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
Re: How to get the "fragment" portion of a URI from $r
Posted by John Siracusa <si...@mindspring.com>.
On 4/14/03 6:11 PM, Iain Truskett wrote:
> * John Siracusa (siracusa@mindspring.com) [15 Apr 2003 07:06]:
>
> [...]
>> This is troubling...is the fragment only a client-side feature?
>
> Yes.
Ick. I guess that means it's impossible to redirect someone to a secure
version of the exact URL that was requested, because I have no way of
knowing what the fragment part of the URL is! Who designed this protocol
anyway... ;)
-John
Re: How to get the "fragment" portion of a URI from $r
Posted by Iain Truskett <ia...@dellah.org>.
* John Siracusa (siracusa@mindspring.com) [15 Apr 2003 07:06]:
[...]
> This is troubling...is the fragment only a client-side feature?
Yes.
cheers,
--
Iain.
Re: How to get the "fragment" portion of a URI from $r
Posted by John Siracusa <si...@mindspring.com>.
On 4/14/03 4:55 PM, John Siracusa wrote:
> Given a request for:
>
> /foo/bar#blah
>
> It seems that:
>
> $r->uri eq '/foo/bar'
> scalar $r->args eq '' (or maybe undef)
>
> But how can I get the "blah" part using $r without trying to do a regex
> match on $r->the_request or something equally ugly and inefficient?
>
> I want to do this in a trans handler, where I tuck away the requested values
> before (possibly) translating them. Suggestions?
Hmmm...it looks like the fragment part isn't in $r->the_request, and doesn't
even seem to be sent to the web server! This is troubling...is the fragment
only a client-side feature?
-John