]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 783386: Removing PATH_INFO prevents Bugzilla from working correctly with IIS
authorFrédéric Buclin <LpSolit@gmail.com>
Fri, 17 Aug 2012 15:12:06 +0000 (17:12 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Fri, 17 Aug 2012 15:12:06 +0000 (17:12 +0200)
r=dkl a=LpSolit

Bugzilla/CGI.pm

index 09907fb552fcc39f8c791c1850bf6c23c35be415..ed8540b2aa8a72f9faf13305912e619bf5264773 100644 (file)
@@ -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));
+            }
         }
     }