perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Prime <adam.pr...@utoronto.ca>
Subject Re: Apache2::URI::unescape_url
Date Thu, 07 May 2009 20:39:18 GMT
Ryan Gies wrote:
> I'm rather surprised at what I'm seeing, but it appears this method
> (Apache2::URI::unescape_url) is not correctly updating the length scalar
> variable.  Any thoughts? -Ryan
> 
> Output from the below response handler snippet:
> 
>   Before: 'http%3A%2F%2Fexample.com'
>   After : 'http://example.com^@e.com'
> 
> Alternate output (when url encoding the result):
> 
>   Before: 'http%3A%2F%2Fexample.com'
>   After : 'http://example.com%00e.com/
> 

That's pretty weird.  If you modify it to be:

$url = Apache2::URI::unescape_url($url);

then it works ok, though according to the docs on perl.apache.org it's 
not supposed to have a return value.

Adam

> --8<--------------------------------------------
> 
> package Apache2::Test::T1;
> use strict;
> use Apache2::URI;
> 
> sub handler {
>   my $r = shift;
>   $r->content_type('text/plain');
>   my $url = 'http%3A%2F%2Fexample.com';
>   $r->print(sprintf("Before: '%s'\n", $url));
>   Apache2::URI::unescape_url($url);
>   $r->print(sprintf("After : '%s'\n", $url));
>   Apache2::Const::OK;
> }
> 
> 1;
> 
> -------------------------------------------->8--


Mime
View raw message