Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 75595
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: CEBJYRE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 3.59
Fixed in: (no value)



Subject: Unexpected behaviour with partially encoded url in redirect
When performing a redirect with a url that contains both escaped and non escaped ampersands the location that the browser is sent to is not what would be expected. $ perl -e 'use CGI; my $c = CGI->new; print $c->redirect(-url => q{http://localhost/? param1=value&param2=value2&amp;param3=another_value})' gives: Status: 302 Found Location: http://localhost/?param1=valueparam2=value2&ampparam3=another_value rather than: Status: 302 Found Location: http://localhost/?param1=value&param2=value2&param3=another_value as I would expect. I tracked this down to the unescapeHTML functionality which looks for '&[stuff];' which correctly replaces '&amp;' with '&', '&lt;' with '<' etc, but if it hits something that it doesn't recognise (in the above example 'param2=value2&amp' is what it sees as the [stuff] component) it keeps this section but throws away the leading ampersand and the trailing semicolon. Is there any reason that the unescapeHTML function couldn't keep the entire unrecognised section (including the ampersand and semicolon) in a case like this?
Download (untitled) / with headers
text/plain 139b
I encourage you to experiment. See if you can come up with a fix that addresses this case, while keeping other cases working as expected.
Download (untitled) / with headers
text/plain 250b
On Mon Mar 12 08:08:17 2012, MARKSTOS wrote: Show quoted text
> I encourage you to experiment. See if you can come up with a fix that > addresses this case, while keeping other cases working as expected.
I've got a pull request sitting in github, all tests passed.
Merging and releasing tonight. Thanks.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.