[interchange-cvs] interchange - heins modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Sep 10 12:46:00 EDT 2003


User:      heins
Date:      2003-09-10 15:46:47 GMT
Modified:  code/UserTag history_scan.tag
Modified:  lib/Vend Dispatch.pm
Log:
* Remove conditional for caching history on Pragma: no-cache -- this is
  all wrong. The directive is to this page transaction of Interchange,
  i.e. timed-build and such. It should not be used to prevent building
  of history, partly because browsers may send it for their own reason.

* [history-scan] -- there should never be a leading / on page names sent
  to $Tag->area(), and they are removed all the time now.

* Prevent autovivification of $CGI::values{mv_username}, and make CookieLogin
  slightly more efficient when already logged in.

* Add some code to prepare for new site-building feature used in combination
  with AcceptRedirect. Will be committing Config.pm and Server.pm code that
  works with this.

Revision  Changes    Path
1.12      +1 -1      interchange/code/UserTag/history_scan.tag


rev 1.12, prev_rev 1.11
Index: history_scan.tag
===================================================================
RCS file: /var/cvs/interchange/code/UserTag/history_scan.tag,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- history_scan.tag	4 Sep 2003 16:10:49 -0000	1.11
+++ history_scan.tag	10 Sep 2003 15:46:47 -0000	1.12
@@ -89,8 +89,8 @@
 		return $Tag->area($default);
 	}
 	$href =~ s|/+|/|g;
+	$href =~ s|^/||;
 	if ($opt->{pageonly}) {
-		$href =~ s|^/||;
 		return $href;
 	}
 	my $form = '';



1.26      +28 -17    interchange/lib/Vend/Dispatch.pm


rev 1.26, prev_rev 1.25
Index: Dispatch.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Dispatch.pm,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Dispatch.pm	26 Jul 2003 20:25:43 -0000	1.25
+++ Dispatch.pm	10 Sep 2003 15:46:47 -0000	1.26
@@ -1,6 +1,6 @@
 # Vend::Dispatch - Handle Interchange page requests
 #
-# $Id: Dispatch.pm,v 1.25 2003/07/26 20:25:43 mheins Exp $
+# $Id: Dispatch.pm,v 1.26 2003/09/10 15:46:47 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 2002 Mike Heins <mike at perusion.net>
@@ -26,7 +26,7 @@
 package Vend::Dispatch;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 1.25 $, 10);
+$VERSION = substr(q$Revision: 1.26 $, 10);
 
 use POSIX qw(strftime);
 use Vend::Util;
@@ -851,11 +851,7 @@
 		unless defined $Vend::Session->{History};
 	shift @{$Vend::Session->{History}}
 		if $#{$Vend::Session->{History}} >= $Vend::Cfg->{History};
-	if(
-		($CGI::pragma =~ /\bno-cache\b/ and ! $CGI::values{mv_force_cache})
-		or $CGI::values{mv_no_cache}
-		)
-	{
+	if( $CGI::values{mv_no_cache} ) {
 		push (@{$Vend::Session->{History}},  [ 'expired', {} ]);
 	}
 	else {
@@ -1143,11 +1139,23 @@
 	$CGI::host = 'nobody' if $Vend::Cfg->{WideOpen};
 
 	if(! $sessionid) {
-		my $id = $::Variable->{MV_SESSION_ID};
-		$sessionid = $CGI::values{$id} if $CGI::values{$id};
+		if(my $id = $::Variable->{MV_SESSION_ID}) {
+			$sessionid = $CGI::values{$id} if $CGI::values{$id};
+		}
+
+		if(! $sessionid and $CGI::redirect_status and $Vend::Cfg->{RedirectCache}) {
+			$Vend::tmp_session = $Vend::new_session = 1;
+			$sessionid = 'nsession';
+			$Vend::Cookie = 1;
+			$Vend::Cfg->{ScratchDefault}{mv_no_count} = 1;
+			$Vend::Cfg->{ScratchDefault}{mv_no_session_id} = 1;
+			$Vend::write_redirect = 1;
+		}
+
 		if (! $sessionid and $Vend::Cfg->{FallbackIP}) {
 			$sessionid = generate_key($CGI::remote_addr . $CGI::useragent);
 		}
+
 	}
 	elsif (! $::Instance->{ExternalCookie} and $sessionid !~ /^\w+$/) {
 		my $msg = get_locale_message(
@@ -1273,15 +1281,18 @@
 		$::Values = $Vend::Session->{values_repository}{$vspace} ||= {};
 	}
 
-	if($Vend::Cfg->{CookieLogin}) {
+	if($Vend::Cfg->{CookieLogin} and ! $Vend::Session->{logged_in}) {
 		COOKIELOGIN: {
-			last COOKIELOGIN if $Vend::Session->{logged_in};
-			last COOKIELOGIN if defined $CGI::values{mv_username};
-			last COOKIELOGIN unless
-				$CGI::values{mv_username} = Vend::Util::read_cookie('MV_USERNAME');
+			my $username;
 			my $password;
-			last COOKIELOGIN unless
-				$password = Vend::Util::read_cookie('MV_PASSWORD');
+			last COOKIELOGIN
+				if  exists  $CGI::values{mv_username}
+				and defined $CGI::values{mv_username};
+			last COOKIELOGIN
+				unless $username = Vend::Util::read_cookie('MV_USERNAME');
+			last COOKIELOGIN
+				unless $password = Vend::Util::read_cookie('MV_PASSWORD');
+			$CGI::values{mv_username} = $username;
 			$CGI::values{mv_password} = $password;
 			my $profile = Vend::Util::read_cookie('MV_USERPROFILE');
 			local(%SIG);
@@ -1505,6 +1516,7 @@
 			;
 		$template = get_locale_message(500, $template, $err);
 		$template .= "($err)";
+		undef $Vend::write_redirect;
 		response($template);
 	}
 
@@ -1513,7 +1525,6 @@
 
 	do_page() if $status;
 #show_times("end page display") if $Global::ShowTimes;
-
 
 	if(my $macro = $Vend::Cfg->{AutoEnd}) {
 		if($macro =~ /\[\w+/) {







More information about the interchange-cvs mailing list