From 0db95a11d864daf0219dd795cc3cf0ff6d7e3345 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 22 Sep 2005 23:57:59 +0000 Subject: [PATCH] Bug 308876: Iff ssl is "always", whining (and other non-interactive scripts?) get a 302-moved error - Patch by A. Karl Kornel r=joel a=justdave --- Bugzilla/CGI.pm | 2 +- Bugzilla/Util.pm | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm index 6f5a6f6d75..3e86af033f 100644 --- a/Bugzilla/CGI.pm +++ b/Bugzilla/CGI.pm @@ -55,7 +55,7 @@ sub new { $self->charset(''); # Redirect to SSL if required - if (Param('sslbase') ne '' and Param('ssl') eq 'always') { + if (Param('sslbase') ne '' and Param('ssl') eq 'always' and i_am_cgi()) { $self->require_https(Param('sslbase')); } diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index 8887e02d77..3374d2c115 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -33,6 +33,7 @@ use base qw(Exporter); detaint_signed html_quote url_quote value_quote xml_quote css_class_quote + i_am_cgi lsearch max min diff_arrays diff_strings trim wrap_comment find_wrap_point @@ -130,6 +131,12 @@ sub xml_quote { return $var; } +sub i_am_cgi { + # I use SERVER_SOFTWARE because it's required to be + # defined for all requests in the CGI spec. + return exists $ENV{'SERVER_SOFTWARE'} ? 1 : 0; +} + sub lsearch { my ($list,$item) = (@_); my $count = 0; -- 2.47.3