From: lpsolit%gmail.com <> Date: Wed, 26 Jul 2006 06:24:54 +0000 (+0000) Subject: Bug 338869: The 'quicksearch' field in the footer redirects to http:// even when... X-Git-Tag: bugzilla-2.22.1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=978f0c8ee0debd07f29863b32caadd433f78598b;p=thirdparty%2Fbugzilla.git Bug 338869: The 'quicksearch' field in the footer redirects to http:// even when sslbase is in use - Patch by Frédéric Buclin r=mkanat a=myk --- diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index f32d3a1bc4..5163e4769f 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -25,6 +25,7 @@ use strict; use Bugzilla::Config; use Bugzilla::Error; +use Bugzilla::Util; use base qw(Exporter); @Bugzilla::Search::Quicksearch::EXPORT = qw(quicksearch); @@ -102,6 +103,7 @@ my $or = 0; sub quicksearch { my ($searchstring) = (@_); + my $urlbase = correct_urlbase(); # Remove leading and trailing commas and whitespace. $searchstring =~ s/(^[\s,]+|[\s,]+$)//g; @@ -115,8 +117,7 @@ sub quicksearch { if (index($searchstring, ',') < $[) { # Single bug number; shortcut to show_bug.cgi. - print $cgi->redirect(-uri => Param('urlbase') . - "show_bug.cgi?id=$searchstring"); + print $cgi->redirect(-uri => "${urlbase}show_bug.cgi?id=$searchstring"); exit; } else { @@ -135,8 +136,7 @@ sub quicksearch { WHERE alias = ?}, undef, $1)) { - print $cgi->redirect(-uri => Param('urlbase') . - "show_bug.cgi?id=$1"); + print $cgi->redirect(-uri => "${urlbase}show_bug.cgi?id=$1"); exit; } } @@ -378,8 +378,7 @@ sub quicksearch { if ($cgi->param('load')) { # Param 'load' asks us to display the query in the advanced search form. - print $cgi->redirect(-uri => Param('urlbase') . "query.cgi?" . - "format=advanced&" . + print $cgi->redirect(-uri => "${urlbase}query.cgi?format=advanced&" . $modified_query_string); } diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index e02a642a50..6dd21df301 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -34,7 +34,7 @@ use base qw(Exporter); detaint_signed html_quote url_quote value_quote xml_quote css_class_quote - i_am_cgi + i_am_cgi correct_urlbase lsearch max min diff_arrays diff_strings trim wrap_comment find_wrap_point @@ -147,6 +147,20 @@ sub i_am_cgi { return exists $ENV{'SERVER_SOFTWARE'} ? 1 : 0; } +sub correct_urlbase { + return Param('urlbase') if Param('ssl') eq 'never'; + + if (Param('sslbase')) { + return Param('sslbase') if Param('ssl') eq 'always'; + # Authenticated Sessions + return Param('sslbase') if Bugzilla->user->id; + } + + # Set to "authenticated sessions" but nobody's logged in, or + # sslbase isn't set. + return Param('urlbase'); +} + sub lsearch { my ($list,$item) = (@_); my $count = 0; @@ -425,6 +439,7 @@ Bugzilla::Util - Generic utility functions for bugzilla # Functions that tell you about your environment my $is_cgi = i_am_cgi(); + my $urlbase = correct_urlbase(); # Functions for searching $loc = lsearch(\@arr, $val); @@ -546,6 +561,11 @@ Tells you whether or not you are being run as a CGI script in a web server. For example, it would return false if the caller is running in a command-line script. +=item C + +Returns either the C or C parameter, depending on the +current setting for the C parameter. + =back =head2 Searching