Re: Un-baking a baked cookie

2008-01-04 Thread Perrin Harkins
On Jan 4, 2008 9:47 PM, Colin Wetherbee <[EMAIL PROTECTED]> wrote:
>  From the Apache2::Cookie documentation, bake() "adds a Set-Cookie
> header to the outgoing headers table."  Is there a way to undo this
> without manually editing the headers, preferably with Apache2::Cookie
> methods?

Why don't you want to edit the headers?  That seems like the simplest
way to do it.

> (As an aside, would somebody mind briefly explaining the difference
> between the Set-Cookie and Set-Cookie2 headers?

I had never heard of Set-Cookie2, but a quick Google makes it sound
like an RFC that never caught on.

- Perrin


Re: Un-baking a baked cookie

2008-01-04 Thread Colin Wetherbee

Perrin Harkins wrote:

On Jan 4, 2008 9:47 PM, Colin Wetherbee <[EMAIL PROTECTED]> wrote:

 From the Apache2::Cookie documentation, bake() "adds a Set-Cookie
header to the outgoing headers table."  Is there a way to undo this
without manually editing the headers, preferably with Apache2::Cookie
methods?


Why don't you want to edit the headers?  That seems like the simplest
way to do it.


Hi, Perrin.  Thanks for your response.

Well, I don't mind editing the headers, but I'd rather use standardized 
API calls (i.e. through Apache2::Cookie and friends) so that I don't 
have to worry about what's going on under the hood, updating my code for 
Apache2 changes, and so forth.


I'm trying to work out a way to not have to rely on undoing cookies, but 
I haven't had any luck so far.  It's for a complicated authentication 
system.



(As an aside, would somebody mind briefly explaining the difference
between the Set-Cookie and Set-Cookie2 headers?


I had never heard of Set-Cookie2, but a quick Google makes it sound
like an RFC that never caught on.


I'm of the same opinion.  FWIW, the Apache2::Cookie module seems to 
support it [0].


Colin

[0] http://tinyurl.com/2ubw2m


Re: Un-baking a baked cookie

2008-01-05 Thread David Dick

Perrin Harkins wrote:

(As an aside, would somebody mind briefly explaining the difference
between the Set-Cookie and Set-Cookie2 headers?



I had never heard of Set-Cookie2, but a quick Google makes it sound
like an RFC that never caught on.
Agreed, with the extremely notable exception of HTTP::Cookies, which 
means every attempt to use cookies with LWP means you need to explicitly 
disable Set-Cookie2 headers.




Re: Un-baking a baked cookie

2008-01-05 Thread Colin Wetherbee

Perrin Harkins wrote:

On Jan 5, 2008 12:56 AM, Colin Wetherbee <[EMAIL PROTECTED]> wrote:

Well, I don't mind editing the headers, but I'd rather use standardized
API calls (i.e. through Apache2::Cookie and friends) so that I don't
have to worry about what's going on under the hood, updating my code for
Apache2 changes, and so forth.


Cookies are pretty simple.  The main reason to use a library is just
to get the formatting right.  The actual header manipulation is not
likely to change, so I think you're not taking much of a risk by doing
it directly.


I'll keep that in mind.  Thanks again.

Colin


Re: Un-baking a baked cookie

2008-01-05 Thread Perrin Harkins
On Jan 5, 2008 12:56 AM, Colin Wetherbee <[EMAIL PROTECTED]> wrote:
> Well, I don't mind editing the headers, but I'd rather use standardized
> API calls (i.e. through Apache2::Cookie and friends) so that I don't
> have to worry about what's going on under the hood, updating my code for
> Apache2 changes, and so forth.

Cookies are pretty simple.  The main reason to use a library is just
to get the formatting right.  The actual header manipulation is not
likely to change, so I think you're not taking much of a risk by doing
it directly.

- Perrin


Re: Un-baking a baked cookie

2008-01-07 Thread Peter Haworth
On Sat, 05 Jan 2008 00:56:49 -0500, Colin Wetherbee wrote:
> > On Jan 4, 2008 9:47 PM, Colin Wetherbee <[EMAIL PROTECTED]>
> > wrote:
> >>  From the Apache2::Cookie documentation, bake() "adds a Set-
> >>  Cookie header to the outgoing headers table." Is there a way to
> >>  undo this without manually editing the headers, preferably with
> >>  Apache2::Cookie methods?
>
> I'm trying to work out a way to not have to rely on undoing cookies,
> but I haven't had any luck so far. It's for a complicated
> authentication system.

Then don't bake them until you're ready to send them. I have a similar
situation in which my session information might change during the
course of the request, but each step wants to make sure that if it's
the last one, those changes get into the cookie. Instead of baking
when setting the cookie value, I just stuff it into a hash based on
the cookie name (which lets me handle multiple cookies this way should
the need arise). My application has a method which calls Apache's
send_http_header() method, amongst other things, so I just bake all
the saved cookies in this method before calling send_http_header().

-- 
Peter Haworth   [EMAIL PROTECTED]
"Oh, good grief. This is version *0.01*!
 Sheesh, not everything is going to look like Hemmingway writing C."
-- Dan Sugalski


Re: Un-baking a baked cookie

2008-01-07 Thread Rafael Caceres
Colin,
At least with CGI.pm, what I do is 'bake' an empty cookie. That has the
desired effect.

Rafael Caceres
On Fri, 2008-01-04 at 21:47 -0500, Colin Wetherbee wrote:
> Good evening.
> 
> Is it possible to un-bake a baked cookie?
> 
>  From the Apache2::Cookie documentation, bake() "adds a Set-Cookie 
> header to the outgoing headers table."  Is there a way to undo this 
> without manually editing the headers, preferably with Apache2::Cookie 
> methods?
> 
> (As an aside, would somebody mind briefly explaining the difference 
> between the Set-Cookie and Set-Cookie2 headers?  Is Set-Cookie2 
> preferred now?  Can it be implemented by just changing instances of 
> bake() to bake2()?)
> 
> Thanks.
> 
> Colin
> 
> !DSPAM:477ef043147221748623000!
> 
> 
> 
>  Information from NOD32 
> This message was checked by NOD32 Antivirus System for Linux Mail Servers.
>   part000.txt - is OK
> http://www.eset.com
> 



Re: Un-baking a baked cookie

2008-01-08 Thread Colin Wetherbee

Peter Haworth wrote:

On Sat, 05 Jan 2008 00:56:49 -0500, Colin Wetherbee wrote:

On Jan 4, 2008 9:47 PM, Colin Wetherbee <[EMAIL PROTECTED]>
wrote:

 From the Apache2::Cookie documentation, bake() "adds a Set-
 Cookie header to the outgoing headers table." Is there a way to
 undo this without manually editing the headers, preferably with
 Apache2::Cookie methods?

I'm trying to work out a way to not have to rely on undoing cookies,
but I haven't had any luck so far. It's for a complicated
authentication system.


Then don't bake them until you're ready to send them. I have a similar
situation in which my session information might change during the
course of the request, but each step wants to make sure that if it's
the last one, those changes get into the cookie. Instead of baking
when setting the cookie value, I just stuff it into a hash based on
the cookie name (which lets me handle multiple cookies this way should
the need arise). My application has a method which calls Apache's
send_http_header() method, amongst other things, so I just bake all
the saved cookies in this method before calling send_http_header().


I've used your suggestion, along with Hash::Merge, to solve my problem. 
 Thanks!


Colin