From: Frédéric Buclin Date: Fri, 17 Aug 2012 15:12:06 +0000 (+0200) Subject: Bug 783386: Removing PATH_INFO prevents Bugzilla from working correctly with IIS X-Git-Tag: bugzilla-4.3.3~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca3d59070b8e470c3c82399f62e8b801db043e89;p=thirdparty%2Fbugzilla.git Bug 783386: Removing PATH_INFO prevents Bugzilla from working correctly with IIS r=dkl a=LpSolit --- diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 09907fb552..ed8540b2aa 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -61,11 +61,18 @@ sub new { # Moreover, it causes unexpected behaviors, such as totally breaking # the rendering of pages. my $script = basename($0); - if ($self->path_info) { + if (my $path_info = $self->path_info) { my @whitelist; Bugzilla::Hook::process('path_info_whitelist', { whitelist => \@whitelist }); if (!grep($_ eq $script, @whitelist)) { - print $self->redirect($self->url(-path => 0, -query => 1)); + # IIS includes the full path to the script in PATH_INFO, + # so we have to extract the real PATH_INFO from it, + # else we will be redirected outside Bugzilla. + my $script_name = $self->script_name; + $path_info =~ s/^\Q$script_name\E//; + if ($path_info) { + print $self->redirect($self->url(-path => 0, -query => 1)); + } } }