]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 338869: The 'quicksearch' field in the footer redirects to http:// even when...
authorlpsolit%gmail.com <>
Wed, 26 Jul 2006 06:24:54 +0000 (06:24 +0000)
committerlpsolit%gmail.com <>
Wed, 26 Jul 2006 06:24:54 +0000 (06:24 +0000)
Bugzilla/Search/Quicksearch.pm
Bugzilla/Util.pm

index f32d3a1bc4f6d9db0297321daaebf93673704d72..5163e4769f390025c7d917988c72e8045efae372 100644 (file)
@@ -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&amp;" .
+        print $cgi->redirect(-uri => "${urlbase}query.cgi?format=advanced&amp;" .
                                      $modified_query_string);
     }
 
index e02a642a50765f56a265cb547dc2a5f0d6b49fb9..6dd21df30112cbd96bbbaba7baa9178f1999b60d 100644 (file)
@@ -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<correct_urlbase()>
+
+Returns either the C<sslbase> or C<urlbase> parameter, depending on the
+current setting for the C<ssl> parameter.
+
 =back
 
 =head2 Searching