From ca3d59070b8e470c3c82399f62e8b801db043e89 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Fri, 17 Aug 2012 17:12:06 +0200 Subject: Bug 783386: Removing PATH_INFO prevents Bugzilla from working correctly with IIS r=dkl a=LpSolit --- Bugzilla/CGI.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 09907fb55..ed8540b2a 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)); + } } } -- cgit v1.2.3-24-g4f1b