Re: [Templates] TT2, Apache2, mod_perl2, Apache::SessionManager

[prev] [thread] [next] [Date index for 2004/06/12]

From: Mike Whitaker
Subject: Re: [Templates] TT2, Apache2, mod_perl2, Apache::SessionManager
Date: 08:36 on 12 Jun 2004
--Apple-Mail-1--799468530
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

> I might need Apache::Cookie in other code in this server, so I'll see 
> if I can patch Apache::SessionManager to not *use* Apache::Cookie via 
> a PerlSetEnv.

This seems to work for me. Unofficial patch bumping the version to 
1.02, if anyone else needs it. Basically adds SessionManagerApreq2Hack, 
which, if set to 'On', uses CGI::Cookie even if Apache::Cookie is 
installed.

I have tested this as best I can: no guarantees.


--Apple-Mail-1--799468530
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="diff"
Content-Disposition: attachment;
	filename=diff

diff -ruN Apache-SessionManager-1.01/Changes Apache-SessionManager-1.02/Changes
--- Apache-SessionManager-1.01/Changes	2004-01-23 15:40:21.000000000 +0000
+++ Apache-SessionManager-1.02/Changes	2004-06-12 08:23:51.000000000 +0000
@@ -109,3 +109,6 @@
 	! Update cookpood. Fix pod tags. Moved all '=for html' sections.
 	  Arranged text to fit 80 columns
 	+ Added patches/README file with some info about included patches
+
+1.02    Sat Jun 12 09:19:00 2004
+	! Patch using SessionManagerApreq2Hack to workround libapreq2 error
diff -ruN Apache-SessionManager-1.01/META.yml Apache-SessionManager-1.02/META.yml
--- Apache-SessionManager-1.01/META.yml	2004-01-23 16:44:49.000000000 +0000
+++ Apache-SessionManager-1.02/META.yml	2004-06-12 08:14:38.000000000 +0000
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Apache-SessionManager
-version:      1.01
+version:      1.02
 version_from: SessionManager.pm
 installdirs:  site
 requires:
diff -ruN Apache-SessionManager-1.01/SessionManager.pm Apache-SessionManager-1.02/SessionManager.pm
--- Apache-SessionManager-1.01/SessionManager.pm	2004-01-23 16:20:15.000000000 +0000
+++ Apache-SessionManager-1.02/SessionManager.pm	2004-06-12 08:26:47.000000000 +0000
@@ -13,7 +13,7 @@
 use strict;
 
 use vars qw($VERSION);
-$VERSION = '1.01';
+$VERSION = '1.02';
 
 use mod_perl;
 use Apache::Session::Flex;
@@ -48,12 +48,12 @@
 	# Test libapreq modules
 	eval { require Apache::Cookie; Apache::Cookie->can('bake'); Apache::Cookie->can('fetch') };
 	if ($@) {
-		require CGI::Cookie;
 		$libapreq = 0;
 	}
 	else {
 		$libapreq = 1;
 	}
+	require CGI::Cookie; # even if we don't use it.
 }
 
 # Translation URI handler (embeds simple management for session tracking via URI)
@@ -66,7 +66,7 @@
 	my $debug_prefix = "SessionManager ($$):";
 	$session_config{'SessionManagerDebug'} = $r->dir_config('SessionManagerDebug') || 0;
 	foreach ( qw/SessionManagerURITracking SessionManagerTracking SessionManagerEnableModBackhand SessionManagerStoreArgs 
-		          SessionManagerCookieArgs SessionManagerSetEnv SessionManagerExpire/ ) {
+		          SessionManagerCookieArgs SessionManagerSetEnv SessionManagerExpire SessionManagerApreq2Hack/ ) {
 		$session_config{$_} = $r->dir_config($_);
 	}
 
@@ -117,7 +117,7 @@
 	# Get session ID from cookie
 	unless ( $session_config{'SessionManagerURITracking'} eq 'On' ) {
 
-		if ( $libapreq ) {
+		if ( ($session_config{'SessionManagerApreq2Hack'} ne 'On') && $libapreq ) {
 			my %cookies = Apache::Cookie->fetch; 
 			$session_id = $cookies{$session_config{'SessionManagerName'}}->value if defined $cookies{$session_config{'SessionManagerName'}};
 			print STDERR "$debug_prefix Apache::Cookie fetch\n" if $session_config{'SessionManagerDebug'} >= 5;
@@ -232,8 +232,8 @@
 				}
 			}
 
-			# Set cookie with Apache::Cookie
-			if ( $libapreq ) {
+			# Set cookie with Apache::Cookies
+			if (($session_config{'SessionManagerApreq2Hack'} ne 'On') &&  $libapreq ) {
 				my $cookie = Apache::Cookie->new($r,
 					name => $session_config{'SessionManagerName'},
 					value => $session_id,
@@ -925,6 +925,13 @@
 If greather than zero, debug informations will be print to STDERR. The default
 value is C<0> (no debug information will be print).
 
+=item C<SessionManagerApreq2Hack> On|Off
+
+This directive forces SessionManager to use CGI::Cookie even if Apache::Cookie
+from libapreq2 is available.
+
+   PerlSetVar SessionManagerApreq2Hack On
+
 =item C<SessionManagerEnableModBackhand> On|Off
 
 This single directive enable mod_backhand sticky session load balancing

--Apple-Mail-1--799468530--


_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

(message missing)

Re: [Templates] TT2, Apache2, mod_perl2, Apache::SessionManager
Mike Whitaker 08:36 on 12 Jun 2004

[Templates] Templates and mod_rewrite.
=?ISO-8859-1?Q?Lo=EFc?= Paillotin 09:22 on 22 Jun 2004

Re: [Templates] Templates and mod_rewrite.
=?ISO-8859-1?Q?Lo=EFc?= Paillotin 09:43 on 22 Jun 2004

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52