Trevor Phillips <[EMAIL PROTECTED]> wrote:
> I'm revisiting a routine I have which in the ContentHandler phase,
> redirects to another URI (status 302). While redirecting, I'd like to
> also set a cookie.
>
> I set the URI header as well, due to habit. Didn't there used to be a browser
> which required URI instead of Location? Is it safe to only use Location??
> 
> However, in my output from the above, I don't see the URI heading, and I don't
> see the cookie heading. So I came up with the following alternative:
> [ $r->status(302); ... return OK ]

I've come across the same problem, and I like to set URI along with
Location too.

I don't like the workaround solution, because it makes Apache log a
'200' return code.  What I did was something like this:

        $r->header_out(Location => $url);
        $r->err_header_out(URI => $url);
        err_cookies($r);
        return REDIRECT;

where err_cookies is:

sub err_cookies {
  my $r = shift;
  my @cookies = $r->headers_out->get("Set-Cookie");
  $r->err_headers_out->add("Set-Cookie" => \@cookies);
}

That seems to do the trick for me.

-- 
Roger Espel Llima, [EMAIL PROTECTED]
http://www.iagora.com/~espel/index.html

Reply via email to