On Wed, Apr 23, 2008 at 5:28 PM, Perrin Harkins <[EMAIL PROTECTED]> wrote:

> On Mon, Apr 21, 2008 at 4:30 PM, J Amuse <[EMAIL PROTECTED]> wrote:
> >
> >
> > http://perl.apache.org/docs/2.0/user/coding/coding.html#Generating_HTTP_Response_Headers
> > <http://perl.apache.org/docs/2.0/user/handlers/filters.html#Introducing_Filters>
> >
>
> 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.

Reply via email to