in reply to Unable to create session, add params, and redirect
Two things occur to me: 1) Anonymous Monk's sample shows the header looking about right but without status. The status might matter (30#) so you could try adding a flag for it. The HTTP spec requires absolute URIs for redirect locations. You're using a relative one. While relative ones work in practice most of the time you should make it absolute.
Also, I'm not positive any of this addresses your problem but have at it-
use strict; use warnings; use CGI (); use CGI::Session(); use URI (); my $session = CGI::Session->new or die CGI::Session->errstr; my $uri = URI->new( CGI::url() ); $uri->query("page=1"); # might want to $uri->fragment(""), etc... print $session->header(-location => $uri, -status => 302 ); __END__ moo@cow[3505]~/bin>curl -i http://localhost/cgi/pm-764431-2.cgi HTTP/1.1 302 Found Date: Sun, 17 May 2009 05:20:44 GMT Server: Apache/2.2.3 (Unix) mod_fastcgi/2.4.2 Set-Cookie: CGISESSID=0ea36d11385258e787e3b31a31f23cb1; path=/ Location: http://localhost/cgi/pm-764431-2.cgi?page=1 Content-Length: 0 Content-Type: text/html; charset=ISO-8859-1
Use URI::QueryParam for non-trivial query string manipulation.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unable to create session, add params, and redirect
by bradcathey (Prior) on May 17, 2009 at 12:18 UTC | |
by Anonymous Monk on May 17, 2009 at 13:53 UTC | |
by Your Mother (Archbishop) on May 18, 2009 at 16:40 UTC | |
by Anonymous Monk on May 18, 2009 at 16:46 UTC | |
by Your Mother (Archbishop) on May 18, 2009 at 16:52 UTC |