Subject: | PATH_INFO is not removed if it contains a double slash |
Date: | Fri, 17 Aug 2012 01:31:50 +0200 |
To: | bug-CGI.pm [...] rt.cpan.org |
From: | "Frédéric Buclin" <lpsolit [...] gmail.com> |
I use the following code to remove PATH_INFO if present:
if ($self->path_info) {
print $self->redirect($self->url(-path => 0, -query => 1));
}
When the URL is
https://localhost/bugzilla/index.cgi/plop.cgi/tudu//id=98/klkjlk
$self->path_info returns /plop.cgi/tudu//id=98/klkjlk as expected.
So I could expect $self->url(-path => 0, -query => 1) to return
https://localhost/bugzilla/index.cgi only, but in fact it returns the
full URL again. This makes the web application to enter an infinite loop.
If I replace the double // by a single one, then CGI redirects the user
to the expected URL.
As CGI is aware of what PATH_INFO is, it should be able to correctly
remove this part from the URL and avoid the infinite loop mentioned above.