In CGI.pm 3.19 and later, calling url() in a context like
http://validator.w3.org/check?uri=http%3A%2F%2Fmissingno.ifrance.com%2FC%2B%2B.php
, an unescaped script uri is used as a regexp, causing breakage like this:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=4365
Possible fix against 3.27 attached.
On a related note, it is not clear to me exactly where
_name_and_path_from_env should be detecting an Apache bug from, from the
complete URI or only the part excluding the query string? Currently it
doesn't exclude the query string, so if it contains a // (such as in the
validator.w3.org case above), it is flagged as an Apache bug and
consequently the returned script name will contain the query string.
Surely this is not intentional?
Subject: | cgi.patch |
--- CGI.pm~ 2007-03-05 18:51:52.000000000 +0200
+++ CGI.pm 2007-03-05 19:58:50.000000000 +0200
@@ -2697,7 +2697,7 @@
my $request_uri = unescape($self->request_uri) || '';
my $query_str = $self->query_string;
- my $rewrite_in_use = $request_uri && $request_uri !~ /^$script_name/;
+ my $rewrite_in_use = $request_uri && $request_uri !~ /^\Q$script_name\E/;
undef $path if $rewrite_in_use && $rewrite; # path not valid when rewriting active
my $uri = $rewrite && $request_uri ? $request_uri : $script_name;