Skip Menu |

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 8041
Status: resolved
Priority: 0/
Queue: CGI-Session

People
Owner: Nobody in particular
Requestors: makoto [...] cpan.org
mleblanc [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 3.95
Fixed in: (no value)



Subject: header method problem
header method does not receive a -charset argument. <CODE> use CGI::Session; my $session = new CGI::Session(undef, undef, {Directory=>'./tmp'}); print $session->header(-charset=>'shift_jis'); </CODE> <RESULT> Set-Cookie: CGISESSID=d64da898dddc28633dc383ee1ab9f5da; path=/ Date: Mon, 04 Aug 2003 06:15:41 GMT Content-Type: text/html; charset=ISO-8859-1 </RESULT> <PATCH> sub header { my $self = shift; my $cgi = $self->{_SESSION_OBJ}; unless ( defined $cgi ) { require CGI; $self->{_SESSION_OBJ} = CGI->new(); return $self->header(@_); # <- this change } my $cookie = $cgi->cookie($self->name(), $self->id() ); return $cgi->header( -type => 'text/html', -cookie => $cookie, @_ ); } </PATCH>
Subject: header method problem (should be classed important)
From: Jody Belka <KNEW>
[MAKOTO - Mon Aug 4 02:33:09 2003]: Show quoted text
> return $self->header(@_); # <- this change
I believe that this should not be classed as a wishlist item, but as important, as this bug hits any time that you want to pass additional headers to the header method but didn't supply a cgi object at creation time (as i found out only today when trying to do a redirect). -- Jody Belka knew (at) cpan (dot) org
Subject: header ignores parameters
Unless the second parameter to new is a CGI object, the first call to header disregards all parameters. However, the subsequent calls work as expected. I've attached a simple patch that should fix the problem. For more information, refer to http://www.perlmonks.net/index.pl?node_id=400190
--- Session.pm Mon Oct 18 12:33:56 2004 +++ Session-b.pm Mon Oct 18 12:34:54 2004 @@ -1218,8 +1218,7 @@ my $cgi = $self->{_SESSION_OBJ}; unless ( defined $cgi ) { require CGI; - $self->{_SESSION_OBJ} = CGI->new(); - return $self->header(); + $cgi = $self->{_SESSION_OBJ} = CGI->new(); } my $cookie = $cgi->cookie($self->name(), $self->id() );
From: markstos [...] cpan.org
[guest - Mon Oct 18 13:36:06 2004]: Show quoted text
> Unless the second parameter to new is a CGI object, the first call to > header disregards all parameters. However, the subsequent calls > work as expected. I've attached a simple patch that should fix the > problem. > > For more information, refer to > http://www.perlmonks.net/index.pl?node_id=400190
Thanks for the report. I'm helping to resolve these bug reports. Could you re-submit a patch against the last 4.x release, along with a Test::More style test case that illustrates the bug? By helping to decentralize some of this work, this work will be able to progress faster. Please cc: me directly on your reply as well. Thanks! Mark
Subject: header method problem (dupe)
From: markstos [...] cpan.org
[MAKOTO - Mon Aug 4 02:33:09 2003]: Show quoted text
> header method does not receive a -charset argument. > > <CODE> > use CGI::Session; > my $session = new CGI::Session(undef, undef, {Directory=>'./tmp'}); > print $session->header(-charset=>'shift_jis'); > </CODE> > > <RESULT> > Set-Cookie: CGISESSID=d64da898dddc28633dc383ee1ab9f5da; path=/ > Date: Mon, 04 Aug 2003 06:15:41 GMT > Content-Type: text/html; charset=ISO-8859-1 > </RESULT> > > <PATCH> > sub header { > my $self = shift; > > my $cgi = $self->{_SESSION_OBJ}; > unless ( defined $cgi ) { > require CGI; > $self->{_SESSION_OBJ} = CGI->new(); > return $self->header(@_); # <- this change > } > > my $cookie = $cgi->cookie($self->name(), $self->id() ); > > return $cgi->header( > -type => 'text/html', > -cookie => $cookie, > @_ > ); > } > </PATCH>
This report is a dupe of RT#8041 and can be merged into that ticket.