[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Edit HTTP response headers


On Wed, Apr 23, 2008 at 5:28 PM, Perrin Harkins <suppressed> wrote:
On Mon, Apr 21, 2008 at 4:30 PM, J Amuse <suppressed> wrote:


Thanks Perrin.
This link references the set method, which will overwrite the header value. I want to append text (i.e. append a secure and httponly flag if there is a Set-Cookie header in the HTTP response). Is this possible with the overlay method? How can I extract the contents of the Set-Cookie header to modify it?
 
For future reference, I was able to manipulate the HTTP headers via the following code snippet:

sub handler
{
    my $f = shift;

    unless ($f->ctx)
    {
        my $SecureFlags = "\; secure\; HttpOnly\;";
        my $Cookie = $f->r->headers_out->get("Set-Cookie");
       
        if ($Cookie)
        {
            $Cookie .= $SecureFlags;
            $f->r->headers_out->set("Set-Cookie" => "$Cookie");
        }
        $f->ctx(1);
    }
}

Thanks again to Perrin for all his help.


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.