help-gnats
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

access using http AND/OR https protocols


From: Dirk Schenkewitz
Subject: access using http AND/OR https protocols
Date: Tue, 26 Nov 2002 17:56:56 +0100

Hi All,

Has anybody had difficulties accessing GnatsWeb via https, while
accessing via http worked fine?

This happened here. The problem was, that Gnatsweb uses the 'full'
path, which comes with protocol and servername. So, when the script
tried to refer to itself, it always used "http:..."-stuff.
After some fiddling, reading docs and so on I figured out what
to do: I changed every occurance of '$q->url()' into:
'$q->url(-relative=>1)' and most occurances of '$q->self_url()'
into: '$q->url(-path_info=>1,-query=>1,-relative=>1)'.

With this change, it works in both cases. :-)

Now my questions:
 - Is this of interest for the community ?
 - Or is there a disadvantage of using '-relative=>1' ? (if yes:
     It also works with '-absolute=>1' instead of '-relative=>1',
 -   would that be better ?)

(I made a patch which is appended, just in case of interest. But
please be careful, I don't use the newest version from cvs, so at
least some of the line numbers are very likely wrong.)

happy coding
        dirk
-- 
Dirk Schenkewitz 

InterFace AG                 fon: +49 (0)89 / 610 49 - 126
Leipziger Str. 16            fax: +49 (0)89 / 610 49 - 83
D-82008 Unterhaching         
http://www.interface-ag.de   mailto:address@hidden
--- gnatsweb.pl.~       Mon Nov  4 12:41:56 2002
+++ gnatsweb.pl Tue Nov 26 17:29:01 2002
@@ -1266,9 +1266,10 @@
 sub get_pr_url
 {
   my($cmd, $pr, $include_return_url) = @_;
-  my $url = $q->url() . "?cmd=$cmd&database=$global_prefs{'database'}";
+  my $url = $q->url(-relative=>1) . 
"?cmd=$cmd&database=$global_prefs{'database'}";
   $url .= "&pr=$pr" if $pr;
-  $url .= "&return_url=" . $q->escape($q->self_url())
+  $url .= "&return_url=" . 
+         $q->escape($q->url(-path_info=>1,-query=>1,-relative=>1))
         if $include_return_url;
   return $url;
 }
@@ -2499,7 +2500,7 @@
         $q->end_form();
 
   # Provide a URL which someone can use to bookmark this query.
-  my $url = $q->self_url();
+  my $url = $q->url(-path_info=>1,-query=>1,-relative=>1);
   # strip empty params out of $url.  in a gnats db with many
   # fields, the url query-string will become very long.  this is a
   # problem, since IE5 truncates query-strings at ~2048 characters.
@@ -2524,7 +2525,7 @@
   # Note: include hidden 'cmd' so user can simply press Enter w/o clicking.
   print $q->hidden(-name=>'cmd', -value=>'store query', -override=>1),
         $q->submit('cmd', 'store query'),
-        $q->hidden('return_url', $q->self_url()),
+        $q->hidden('return_url', 
$q->url(-path_info=>1,-query=>1,-relative=>1)),
         "\n</td>\n</tr>\n</table>",
         $q->end_form();
 }
@@ -2657,7 +2658,7 @@
           $q->start_form(),
          hidden_debug(),
           "<td>",
-          $q->hidden('return_url', $q->self_url()),
+          $q->hidden('return_url', 
$q->url(-path_info=>1,-query=>1,-relative=>1)),
           hidden_db(),
           $q->submit('cmd', 'delete stored query'),
           "<td>&nbsp;<td>",
@@ -2699,7 +2700,7 @@
   {
     # 9/10/99 kenstir: Must use full (not relative) URL in redirect.
     # Patch by Elgin Lee <address@hidden>.
-    my $query_url = $q->url() . '?cmd=' . $q->escape('submit query')
+    my $query_url = $q->url(-relative=>1) . '?cmd=' . $q->escape('submit 
query')
           . '&' . $query_string;
     if ($debug)
     {
@@ -3319,7 +3320,7 @@
 
        my (@db_list) = client_cmd("dbls");
        if (length($db_list[0]) == 0 || $client_would_have_exited) {
-           login_page($q->url());
+           login_page($q->url(-relative=>1));
            exit();
        } else {
            # store the list of databases for later use
@@ -3330,7 +3331,7 @@
        # use the three-arg version, to authenticate at the same time
        my (@chdb_response) = client_cmd("chdb $global_prefs{'database'} 
$db_prefs{'user'} $db_prefs{'password'}");
        if (length($chdb_response[0]) == 0 || $client_would_have_exited) {
-           login_page($q->url());
+           login_page($q->url(-relative=>1));
            exit();
        }
 
@@ -3764,7 +3765,7 @@
 {
     $global_prefs{'database'} = $q->param('new_db');
     my $global_cookie = create_global_cookie();
-    my $url = $q->url();
+    my $url = $q->url(-relative=>1);
     # the refresh header chokes on the query-string if the
     # params are separated by semicolons...
     $url =~ s/\;/&/g;
@@ -3787,7 +3788,7 @@
                              -value => 'does not matter',
                              -path => $global_cookie_path,
                              -expires => '-1d');
-  my $url = $q->url();
+  my $url = $q->url(-relative=>1);
   # the refresh header chokes on the query-string if the
   # params are separated by semicolons...
   $url =~ s/\;/&/g;
@@ -3842,7 +3843,7 @@
     $url =~ s/\;/&/g;
 
     # 11/27/99 kenstir: Try zero-delay refresh all the time.
-    $url = $q->url() if (!defined($url));
+    $url = $q->url(-relative=>1) if (!defined($url));
     # 11/14/99 kenstir: For some reason doing cookies + redirect didn't
     # work; got a 'page contained no data' error from NS 4.7.  This cookie
     # + redirect technique did work for me in a small test case.
@@ -4153,7 +4154,7 @@
     # We don't have username/password/database; give login page then
     # redirect to the url they really want (self_url).
     print_header();
-    login_page($q->self_url());
+    login_page($q->url(-path_info=>1,-query=>1,-relative=>1));
     exit();
   }
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]