summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/CGI.pm4
-rw-r--r--Bugzilla/Quantum/CGI.pm2
-rw-r--r--Bugzilla/Quantum/Plugin/Hostage.pm5
-rw-r--r--Bugzilla/Util.pm3
4 files changed, 12 insertions, 2 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm
index 01d610db1..1bf0dd54a 100644
--- a/Bugzilla/CGI.pm
+++ b/Bugzilla/CGI.pm
@@ -141,6 +141,7 @@ sub new {
# apache collapses // to / in $ENV{PATH_INFO} but not in $self->path_info.
# url() requires the full path in ENV in order to generate the correct url.
$ENV{PATH_INFO} = $path;
+ DEBUG("redirecting because we see PATH_INFO and don't like it");
print $self->redirect($self->url(-path => 0, -query => 1));
exit;
}
@@ -151,6 +152,7 @@ sub new {
# Redirect to urlbase if we are not viewing an attachment.
if ($self->url_is_attachment_base and $script ne 'attachment.cgi') {
+ DEBUG("Redirecting to urlbase because the url is in the attachment base and not attachment.cgi");
$self->redirect_to_urlbase();
}
@@ -782,6 +784,7 @@ sub redirect_search_url {
# are only redirected if they're under the CGI_URI_LIMIT though.
my $self_url = $self->self_url();
if ($self->request_method() ne 'POST' or length($self_url) < CGI_URI_LIMIT) {
+ DEBUG("Redirecting search url");
print $self->redirect(-url => $self_url);
exit;
}
@@ -803,6 +806,7 @@ sub redirect_to_https {
# XML-RPC clients (SOAP::Lite at least) require a 301 to redirect properly
# and do not work with 302. Our redirect really is permanent anyhow, so
# it doesn't hurt to make it a 301.
+ DEBUG("Redirecting to https");
print $self->redirect(-location => $url, -status => 301);
exit;
}
diff --git a/Bugzilla/Quantum/CGI.pm b/Bugzilla/Quantum/CGI.pm
index 7585d888a..0a74f1ee5 100644
--- a/Bugzilla/Quantum/CGI.pm
+++ b/Bugzilla/Quantum/CGI.pm
@@ -117,7 +117,7 @@ sub _ENV {
CONTENT_LENGTH => $content_length || 0,
CONTENT_TYPE => $headers->content_type || '',
GATEWAY_INTERFACE => 'CGI/1.1',
- HTTPS => $req->is_secure ? 'YES' : 'NO',
+ HTTPS => $req->is_secure ? 'on' : 'off',
%env_headers,
QUERY_STRING => $cgi_query->to_string,
PATH_INFO => $path_info ? "/$path_info" : '',
diff --git a/Bugzilla/Quantum/Plugin/Hostage.pm b/Bugzilla/Quantum/Plugin/Hostage.pm
index 19c77995e..cbde7b5ee 100644
--- a/Bugzilla/Quantum/Plugin/Hostage.pm
+++ b/Bugzilla/Quantum/Plugin/Hostage.pm
@@ -1,6 +1,7 @@
package Bugzilla::Quantum::Plugin::Hostage;
use 5.10.1;
use Mojo::Base 'Mojolicious::Plugin';
+use Bugzilla::Logging;
sub _attachment_root {
my ($base) = @_;
@@ -50,6 +51,7 @@ sub _before_routes {
return if $path eq '/__lbheartbeat__';
if ( $attachment_base && $hostname eq $attachment_root ) {
+ DEBUG("redirecting to $urlbase because $hostname is $attachment_root");
$c->redirect_to($urlbase);
return;
}
@@ -61,6 +63,7 @@ sub _before_routes {
my $new_uri = $url->clone;
$new_uri->scheme( $urlbase_uri->scheme );
$new_uri->host($urlbase_host);
+ DEBUG("redirecting to $new_uri because $hostname matches attachment regex");
$c->redirect_to($new_uri);
return;
}
@@ -69,10 +72,12 @@ sub _before_routes {
my $new_uri = $urlbase_uri->clone;
$new_uri->path('/show_bug.cgi');
$new_uri->query_form( id => $id );
+ DEBUG("redirecting to $new_uri because $hostname includes bug id");
$c->redirect_to($new_uri);
return;
}
else {
+ DEBUG("redirecting to $urlbase because $hostname doesn't make sense");
$c->redirect_to($urlbase);
return;
}
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index a8477a62d..aa524b263 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -29,7 +29,7 @@ use base qw(Exporter);
get_text template_var disable_utf8
enable_utf8 detect_encoding email_filter
round extract_nicks);
-
+use Bugzilla::Logging;
use Bugzilla::Constants;
use Bugzilla::RNG qw(irand);
@@ -317,6 +317,7 @@ sub do_ssl_redirect_if_required {
# If we're already running under SSL, never redirect.
return if $ENV{HTTPS} && $ENV{HTTPS} eq 'on';
+ DEBUG("Redirect to HTTPS because \$ENV{HTTPS}=$ENV{HTTPS}");
Bugzilla->cgi->redirect_to_https();
}