Package: libapache-session-wrapper-perl
Version: 0.17-4.0
Severity: important
Tags: patch
When run with mod_perl2, Apache::Session::Wrapper gives the error:
[Fri Feb 11 16:09:18 2005] [error] [client 127.0.0.1] The 'header_object'
parameter ("Apache::Request=SCALAR(0x600000000037fa70)") to
Apache::Session::Wrapper->new() did not pass the 'header method'
callback\n\nStack:\n [/usr/share/perl5/HTML/Mason/ApacheHandler.pm:916]\n
[/usr/share/perl5/HTML/Mason/ApacheHandler.pm:824]\n [(eval 27):8]\n [-e:0]\n
I poked through the source, and discovered this is because with
mod_perl2, $r is an Apache::RequestRec instance, not Apache::Request.
Apache::RequestRec uses 'headers_out' and 'err_headers_out' instead of
'header_out' and 'err_header_out'. Otherwise, for the purposes of this
module, they might as well be identical.
I've included a patch that will made Apache::Session::Wrapper work
correctly with mod_perl 2 as shipped in unstable.
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: ia64
Kernel: Linux 2.6.9skif
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages libapache-session-wrapper-perl depends on:
ii libapache-session-perl 1.60-2 Perl modules for keeping persisten
ii libclass-container-perl 0.11-0.1 Glues object frameworks together t
ii libexception-class-perl 1.20-1 a module that allows you to declar
ii libparams-validate-perl 0.76-1 validate parameters to Perl method
ii perl 5.8.4-6 Larry Wall's Practical Extraction
-- no debconf information
--- libapache-session-wrapper-perl-0.17/lib/Apache/Session/Wrapper.pm
2004-04-23 16:07:28.000000000 -0600
+++ libapache-session-wrapper-perl-0.17.new/lib/Apache/Session/Wrapper.pm
2005-02-11 16:49:29.955147677 -0700
@@ -7,6 +7,7 @@
$VERSION = '0.17';
use base qw(Class::Container);
+use constant APACHE2 => ($mod_perl::VERSION >= 1.99);
use Apache::Session 1.6;
@@ -85,7 +86,13 @@
{ type => OBJECT,
callbacks =>
{ 'header method' =>
- sub { $_[0]->can('err_header_out') || $_[0]->can('header_out' ) } },
+ sub { if (APACHE2) {
+ return $_[0]->can('err_headers_out') ||
$_[0]->can('headers_out' )
+ } else {
+ return $_[0]->can('err_header_out') ||
$_[0]->can('header_out' )
+ }
+ }
+ },
optional => 1,
descr => 'An object that can be used to send cookies with' },
@@ -615,7 +622,14 @@
else
{
my $header_object = $self->{header_object};
- my $meth = $header_object->can('err_header_out') ? 'err_header_out' :
'header_out';
+
+ my $meth;
+ if (APACHE2) {
+ $meth = $header_object->can('err_headers_out') ? 'err_headers_out'
: 'headers_out';
+
+ } else {
+ $meth = $header_object->can('err_header_out') ? 'err_header_out' :
'header_out';
+ }
$header_object->$meth( 'Set-Cookie' => $cookie );
}
@@ -834,7 +848,8 @@
When running outside of mod_perl, you must provide an object to which
the cookie header can be added. This object must provide either an
-C<err_header_out()> or C<header_out()> method.
+C<err_header_out()> or C<header_out()> method under mod_perl 1, or
+C<err_headers_out()> or C<headers_out()> under mod_perl 2.
Under mod_perl, this will default to the object returned by C<<
Apache->request >>.