[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    RE: Cookie help - using both cgi.pm and APR::Request::Cookie
From:       "cfaust-dougot" <cfaust () doyougot ! com>
Date:       2008-05-28 16:49:00
Message-ID: A749EEA4EA49EA43810745ED3DA83C19C04929 () exchback1 ! pub ! prevare ! com
[Download RAW message or body]

Hi Andre,
 
That was is. Once I created the cookie value like
 
my $cookie_value = qq|$val1&$val2&$val3.....|; 
 
It worked! Now I just got to update everything so I don't need to do that anymore :)
 
Thanks!
-Chris

________________________________

From: André Warnier [mailto:aw@ice-sa.com]
Sent: Wed 5/28/2008 6:27 AM
To: cfaust-dougot
Cc: modperl@perl.apache.org
Subject: Re: Cookie help - using both cgi.pm and APR::Request::Cookie



I don't guarantee that this is the real issue you're having, but be
careful of the following : either of the Apache2::Request::Cookie or
CGI::Cookie (don't remember which one) URL-encodes the cookie value by
default, and the other one does not.  Maybe you're getting caught by that.
One of the modules above offers a "raw_cookie" method to get around
this, but again I don't remember which one.

cfaust-dougot wrote:
> Folks,
> 
> I taking over some really old code and I'm in the process of converting it over to \
> mp2. I want to be able to use APR::Request::Cookie to create the cookie for the new \
> things I'm doing but I need to create it exactly like CGI.pm is currently doing so \
> the old code will continue to work until I get everthing updated. 
> I'm hoping someone knows both methods enough to tell me what I'm doing wrong.
> 
> The CGI.pm cookie is being created like:
> $query->cookie(-name=>'name',-value=>[val1,val2,val3,val4,val5,val6,val7],-expires=>'+5y',-domain=>www.domain.com,-path=>/);
>  
> 
> I do my cookies like:
> my $packed_cookie = APR::Request::Cookie->new($r->pool,
> name  => 'name',
> value  => $cookie_value,             
> path  => '/',
> domain => 'www.domain.com',
> expires => +5y,
> );   
> $r->err_headers_out->add('Set-Cookie' => $packed_cookie->as_string);
> 
> For the value I made an array
> @cookie_value = ('val1','val2','val3','val4','val5',val6','val7');
> 
> In $packed_cookie I tried using @cookie_value directly, I tried it as an arrayref \
> ($cookie_value), I tried it like [@cookie_value] etc and not matter what I do I \
> can't get the old code to read it via 
> my ($val1,$val2,$val3,$val4,$val5,$val6,$val7) = $query->cookie(-name=>'name');
> 
> The cookie is getting set though, I can view it from within Mozilla. It just isn't \
> being read by CGI.pm 
> Does anyone know what I'm doing wrong?
> 
> TIA!!
> 
> 
> 


[Attachment #3 (text/html)]

<HTML dir=ltr><HEAD><TITLE>Re: Cookie help - using both cgi.pm and \
APR::Request::Cookie</TITLE> <META http-equiv=Content-Type content="text/html; \
charset=unicode"> <META content="MSHTML 6.00.6000.16640" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText7471 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Hi Andre,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>That was is. Once I created the cookie value \
like</FONT></DIV> <DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>my $cookie_value = \
qq|$val1&amp;$val2&amp;$val3.....|; </FONT></DIV> <DIV dir=ltr><FONT face=Arial \
size=2></FONT>&nbsp;</DIV> <DIV dir=ltr><FONT face=Arial size=2>It worked! Now I just \
got to update everything so I don't need to do that anymore :)</FONT></DIV> <DIV \
dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV> <DIV dir=ltr><FONT face=Arial \
size=2>Thanks!</FONT></DIV> <DIV dir=ltr><FONT face=Arial \
size=2>-Chris</FONT></DIV></DIV> <DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> André Warnier \
[mailto:aw@ice-sa.com]<BR><B>Sent:</B> Wed 5/28/2008 6:27 AM<BR><B>To:</B> \
cfaust-dougot<BR><B>Cc:</B> modperl@perl.apache.org<BR><B>Subject:</B> Re: Cookie \
help - using both cgi.pm and APR::Request::Cookie<BR></FONT><BR></DIV> <DIV>
<P><FONT size=2>I don't guarantee that this is the real issue you're having, but \
be<BR>careful of the following : either of the Apache2::Request::Cookie \
or<BR>CGI::Cookie (don't remember which one) URL-encodes the cookie value \
by<BR>default, and the other one does not.&nbsp; Maybe you're getting caught by \
that.<BR>One of the modules above offers a "raw_cookie" method to get around<BR>this, \
but again I don't remember which one.<BR><BR>cfaust-dougot wrote:<BR>&gt; \
Folks,<BR>&gt;&nbsp;<BR>&gt; I taking over some really old code and I'm in the \
process of converting it over to mp2. I want to be able to use APR::Request::Cookie \
to create the cookie for the new things I'm doing but I need to create it exactly \
like CGI.pm is currently doing so the old code will continue to work until I get \
everthing updated.<BR>&gt;&nbsp;<BR>&gt; I'm hoping someone knows both methods enough \
to tell me what I'm doing wrong.<BR>&gt;&nbsp;<BR>&gt; The CGI.pm cookie is being \
created like:<BR>&gt; \
$query-&gt;cookie(-name=&gt;'name',-value=&gt;[val1,val2,val3,val4,val5,val6,val7],-ex \
pires=&gt;'+5y',-domain=&gt;www.domain.com,-path=&gt;/);<BR>&gt;&nbsp;<BR>&gt;&nbsp;<BR>&gt; \
I do my cookies like:<BR>&gt;&nbsp; my $packed_cookie = \
APR::Request::Cookie-&gt;new($r-&gt;pool,<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
name&nbsp; =&gt; 'name',<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
value&nbsp; =&gt; $cookie_value,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
path&nbsp; =&gt; '/',<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
domain =&gt; 'www.domain.com',<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
expires =&gt; +5y,<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
);&nbsp;&nbsp;&nbsp;<BR>&gt;&nbsp; $r-&gt;err_headers_out-&gt;add('Set-Cookie' =&gt; \
$packed_cookie-&gt;as_string);<BR>&gt;&nbsp;<BR>&gt; For the value I made an \
array<BR>&gt; @cookie_value = \
('val1','val2','val3','val4','val5',val6','val7');<BR>&gt;&nbsp;<BR>&gt; In \
$packed_cookie I tried using @cookie_value directly, I tried it as an arrayref \
($cookie_value), I tried it like [@cookie_value] etc and not matter what I do I can't \
get the old code to read it via<BR>&gt;&nbsp;<BR>&gt; my \
($val1,$val2,$val3,$val4,$val5,$val6,$val7) = \
$query-&gt;cookie(-name=&gt;'name');<BR>&gt;&nbsp;<BR>&gt; The cookie is getting set \
though, I can view it from within Mozilla. It just isn't being read by \
CGI.pm<BR>&gt;&nbsp;<BR>&gt; Does anyone know what I'm doing \
wrong?<BR>&gt;&nbsp;<BR>&gt; \
TIA!!<BR>&gt;&nbsp;<BR>&gt;&nbsp;<BR>&gt;<BR></FONT></P></DIV></BODY></HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic