Does the order matter? 
 
I'm doing this
 
$r->err_headers_out->add( 'Set-Cookie', $cookie->as_string );
$r->headers_out->set( Location => 'http://domain.com/page'); 
<http://smtp.net.prevare.com/exchweb/bin/redir.asp?URL=http://domain.com/page%27);>
 
return Apache2::Const::REDIRECT;
 
I'm guess it doesn't cause when it does work I'm doing
 
$r->err_headers_out->add( 'Set-Cookie', $cookie->as_string );
return Apache2::Const::OK;
 
I don't get it then, I'm using the same exact thing in both the case of the 
login (post request) and following get request
 
    my $packed_cookie = APR::Request::Cookie->new($r->pool,
                 name  => 'ISMH_SESSION_ID',
                 value  => 'xxx'
                 expires => '+7d',
                 );
    $r->err_headers_out->add('Set-Cookie' => $packed_cookie->as_string);
 
Its never easy :(..
 
Thanks!!

________________________________

From: Clinton Gormley [mailto:[EMAIL PROTECTED]
Sent: Sat 12/9/2006 12:24 PM
To: cfaust-dougot
Cc: modperl@perl.apache.org
Subject: RE: Apache2::Cookie/APR::Request::Cookie




> 
> Can I ask if there is something different when redirecting? It would
> appear the cookie isn't being sent in a redirect.

It should be fine setting cookies in a redirect as long as
1) you're using $r->err_headers_out->add()
2) you're not doing an internal redirect

so, for instance, this sequence:
    $r->headers_out->set( Location => 'http://domain.com/page');
    $r->err_headers_out->add( 'Set-Cookie', $cookie->as_string );
    return Apache2::Const::HTTP_SEE_OTHER;

> 
> When logging in from the post form I see the "Set-Cookie" header being
> set but when I redirect them back to the URl they should be on I don't
> see the "Set-Cookie" header being set even though I pack up the cookie
> and set it again (just like in the previous POST request)

If you're setting the cookie header but you're not seeing it in the
headers from the server, then you're not setting it properly.  Are you
not overwriting the err_headers_out by using ->set instead of ->add?

> 
> But does that even matter? A cookie isn't always set before its read
> in the same session, I might be looking for a cookie that was saved
> the last time you were on the site.

It only matter because it doesn't seem to be working...


clint




Reply via email to