[NoCat] Patch: http_redirect_header-01.patch

Karl Gaissmaier karl.gaissmaier at kiz.uni-ulm.de
Tue, 29 Jul 2003 00:18:49 +0200


--------------Boundary-00=_DZ9RSG9QS5B0WYKN2F0D
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 8bit

Name:
	http_redirect_header-01.patch

Affected Files:
	lib/NoCat/AuthService.pm
	htdocs/login_ok.html
	htdocs/register_ok.html
	htdocs/renew.html
	htdocs/renew_pasv.html

Version:
	Patch against 0.82 or later

Severity:
	necessary for proper redirect after a successful login when the
	user clicks on the offered link.

Description:
	the $redirect is used for two purposes: First in the http-equiv
	and as a normal href in the login_ok form (you get redirected
	in 5 seconds ...). But this is not possible, these are different
	formats, since the http-equiv needs a time in front of the url.
	This introduces a new variable $http_redirect for use in http-equiv
	and the $redirect used in href.
	There exists already a patch from Jacob S. Barrett, but I think
	this patch is not proper handling the renewal time. Please tell me
	if I'm wrong.

-- Karl Gaissmaier KIZ/Infrastructure, University of Ulm, Germany 
Email:karl.gaissmaier@kiz.uni-ulm.de Service Group Network
--------------Boundary-00=_DZ9RSG9QS5B0WYKN2F0D
Content-Type: text/x-diff;
  charset="us-ascii";
  name="http_redirect_header-01.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="http_redirect_header-01.patch"

diff -Naur NoCatAuth-nightly/htdocs/login_ok.html NoCatAuth-mod/htdocs/login_ok.html
--- NoCatAuth-nightly/htdocs/login_ok.html	Thu Aug 15 04:01:25 2002
+++ NoCatAuth-mod/htdocs/login_ok.html	Mon Jul 14 11:16:39 2003
@@ -1,7 +1,7 @@
 <html>
 <head>
     <title>Welcome, $user!</title>
-    <meta http-equiv="Refresh" content="$redirect" />
+    <meta http-equiv="Refresh" content="$http_redirect" />
 </head>
 <script language="JavaScript">
     window.open( "$popup", "NoCat_Login_Renewal", "width=250,height=180,scrollbars=no" );	
diff -Naur NoCatAuth-nightly/htdocs/register_ok.html NoCatAuth-mod/htdocs/register_ok.html
--- NoCatAuth-nightly/htdocs/register_ok.html	Fri Jun 14 07:41:13 2002
+++ NoCatAuth-mod/htdocs/register_ok.html	Mon Jul 14 11:16:58 2003
@@ -1,7 +1,7 @@
 <html>
 <head>
     <title>Welcome, $name!</title>
-    <meta http-equiv="Refresh" content="$redirect" />
+    <meta http-equiv="Refresh" content="$http_redirect" />
 </head>
 <body bgcolor="#FFFFFF">
 <h1><a href="http://nocat.net"><img src="/images/auth_logo.gif" width="112" height="35" border="0"></a></h1>
diff -Naur NoCatAuth-nightly/htdocs/renew.html NoCatAuth-mod/htdocs/renew.html
--- NoCatAuth-nightly/htdocs/renew.html	Fri Jun 14 07:41:13 2002
+++ NoCatAuth-mod/htdocs/renew.html	Mon Jul 14 11:17:12 2003
@@ -1,7 +1,7 @@
 <html>
 <head>
     <title>NoCat login agent</title>
-    <meta http-equiv="Refresh" content="$redirect" />
+    <meta http-equiv="Refresh" content="$http_redirect" />
 </head>
 <body bgcolor="#FFFFFF">
 <p><a href="http://nocat.net" target="_blank"><img src="/images/auth_logo.gif" width="112" height="35" border="0"></a> </p>
diff -Naur NoCatAuth-nightly/htdocs/renew_pasv.html NoCatAuth-mod/htdocs/renew_pasv.html
--- NoCatAuth-nightly/htdocs/renew_pasv.html	Fri Jun 14 07:41:13 2002
+++ NoCatAuth-mod/htdocs/renew_pasv.html	Mon Jul 14 11:17:23 2003
@@ -1,7 +1,7 @@
 <html>
 <head>
     <title>NoCat login agent</title>
-    <meta http-equiv="Refresh" content="$redirect" />
+    <meta http-equiv="Refresh" content="$http_redirect" />
 </head>
 <script language="JavaScript">
     setTimeout( "document.RenewalForm.submit()", $timeout * 1000 );
diff -Naur NoCatAuth-nightly/lib/NoCat/AuthService.pm NoCatAuth-mod/lib/NoCat/AuthService.pm
--- NoCatAuth-nightly/lib/NoCat/AuthService.pm	Thu Oct  3 11:17:02 2002
+++ NoCatAuth-mod/lib/NoCat/AuthService.pm	Mon Jul 14 11:14:07 2003
@@ -289,9 +289,11 @@
     my $redirect = $vars{redirect} || $self->{HomePage};
 
     # Add a refresh time of five seconds... unless one is already set.
-    $vars{redirect} = $redirect = "5; URL=$redirect" unless $redirect =~ /^\d+;/o;
 
-    push @headers, -Refresh => $redirect;
+    $vars{http_redirect} = $redirect;
+    $vars{http_redirect} = "5; URL=$redirect" unless $redirect =~ /^\d+;/o;
+    push @headers, -Refresh => $vars{http_redirect};
+
     # push @headers, -Cookie => $self->{Cookie} if $self->{Cookie};
 
     # Hit the g/w with the ticket first if there is one, get a 304, 

--------------Boundary-00=_DZ9RSG9QS5B0WYKN2F0D--