Overwriting a cookie in request header

"Sinha, Ritu" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <FB816ACEE14B604180685C57F6A64DE6165B020C@GSCMAMP27EX.firmwide.corp.gs.com>
I have an Apache module in which I am trying to overwrite the value of a cookie. I have tried different methods of the APR::Table without success.
Here are the approaches that I have tried:

[1] $r->headers_out->set("Set-Cookie", $cookie);

Here, $cookie has the name=value pair with the name of the cookie that needs to be overwritten. The outcome is 2 cookies with the same name.

[2] $cookie = $r->headers_in->{Cookie};
<search-and-replace the cookie value in $cookie>
$r->headers_out->{Cookie}=$cookie;

Does not do anything to the existing cookie ... does not even add a new cookie.

[3] $cookie = $r->headers_in->{Cookie};
@cookies = split(/;/,$cookie);
$r->headers_out->clear();
< add cookies one-by-one replacing the value of the cookie in question using  $r->headers_out->set("Set-Cookie", $cookie); >

The web application does not work ... seems like clearing the header creates problems.

Any pointers would be really helpful.

Thanks,
Ritu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.