Thanks Ian

It occurred to me after I send the original email that the space may be escaped with a +. It's not clear to me whether spaces are permitted in cookie values - I found different web pages that seemed to contradict each other. Resorting to the regex replace works - and I'm happy with the workaround as long as the + is a result of escaping and nothing else. The weird thing is, if I set what seems to be the same Cookie with CGI, then Apache::Cookie reads it correctly.

All the best

Dan




idstewart <[EMAIL PROTECTED]>

22/10/2004 17:19

       
        To:        [EMAIL PROTECTED]
        cc:        [EMAIL PROTECTED]
        Subject:        Re: Apache::Cookie seems to read different Cookie than CGI



[EMAIL PROTECTED] wrote:

Hi All


I have to read a domain cookie set by a ColdFusion Web Server on a different host. CF sets a cookie value like


[EMAIL PROTECTED]|2004-10-22 16:16:41|70DC39BB99CB4CB826E3F30AA25D97FE

I can read this cookie with CGI.pm, and it seems to identical. When I try to get the same cookie value using Apache::Cookie, it gets returned as


[EMAIL PROTECTED]|2004-10-22+16:16:41|70DC39BB99CB4CB826E3F30AA25D97FE

Note the '+' between the date and time. Unfortunately, this breaks everything, as I need the first two pipe delimited values to hash to the third value (using a key in addition to this). Does anyone know why this would happen, and if there is a workaround?

If I were to hazard a guess, I would say that Apache::Cookie is URL encoding the cookie.  If you URL decode the value returned from Apache::Cookie, you should get the same value that is being reported by CGI.pm and Cold Fusion.

As a poor man's URL decode, you could try something like:

   $cookie =~ s/+/ /g;

This will replace the '+' with a space in the value returned by Apache::Cookie and leave the value returned by CGI.pm unaffected.


HTH.
Ian




********************************************************************************
NOTICE
This email and any attachments are confidential. They may contain privileged
information or copyright material. If you are not an intended recipient, you
should not read, copy, use or disclose the contents without authorisation as
we request you contact us as once by return email. Please then delete the
email and any attachments from your system. We do not accept liability in
connection with computer viruses, data corruption, delay, interruption,
unauthorised access or unauthorised amendment. Any views expressed in this
email and any attachments do not necessarily reflect the views of the
company.
********************************************************************************

Reply via email to