Re: Apache2::Cookie cookie parse error "Expected token not present"
陈建春 <[email protected]> Fri, 25 Dec 2009 11:06:52 +0800
| Newsgroups | gmane.comp.apache.apreq |
|---|---|
| Message-ID | <[email protected]> |
I see, I use Apache2::Cookie to parse and fetch cookie, and I can deal
with the error by this way:
my $cookies;
eval { $cookies = Apache2::Cookie->fetch($r) }
if ($@) {
$cookies = $@->jar;
$cookies->cookie_class('Apache2::Cookie');
}
But as I know, cookie without key is also valid, just as a single "1",
and php will parse this cookie without any complain.
is apreq's parsing regular not intelligent enough?
*陈建春 | ChenJianchun*
傲游Web应用部
E-mail: [email protected] <mailto:[email protected]>
*Maxthon^® * --每个人的互联网中心! 上网从傲游开始!
傲游天下科技有限公司(中国) <http://www.maxthon.cn/> | www.maxthon.cn
<http://www.maxthon.cn/>
*诚信、创新、务实、奋斗!*
Joe Schaefer 写道:
> Apreq doesn't generate cookies that would create a "1" in
> the client's Cookie header. It's some other application that
> did that, but you can tell apreq to ignore the 1 by using eval:
>
> my $req = APR::Request::Apache2->handle($r);
> my $jar = eval {$req->jar()} || $@->jar;
> ...
>
> eval will trap the error and put an APR::Request::Error object
> in $@. Calling ->jar on that object won't cause another exception
> to be thrown.
>
> HTH
>
>
> *From:* 陈建春 <[email protected]>
> *To:* [email protected]
> *Sent:* Wed, December 23, 2009 10:55:41 PM
> *Subject:* Apache2::Cookie cookie parse error "Expected token not
> present"
>
> hi
>
> Our web site http://passport.maxthon.cn use mod_perl2.0.
> but it displays "Expected token not present" on the page
> occasionally.
>
> I log the cookie string in header when the error occur, the
> abnormal cookie would like this:
>
> rtime30013728=0; ltime30013728=1261566403616;
> cnzz_eid30013728=98941722-1261566395-http%3A//gocn.maxthon.com/redir/public/avatar.htm%3Fv%3D3.0.6.4;
> 1;
> MAXAUTH=01000000170000005F47334BDF7A144D7BAA0F4B60AB448E3E79ECE6D111B0BE6B9A461DF1237853
>
> rtime30013728=0; ltime30013728=1261566403616;
> cnzz_eid30013728=98941722-1261566395-http%3A//gocn.maxthon.com/redir/public/avatar.htm%3Fv%3D3.0.6.4;
> MAXAUTH=01000000170000006DA5314BEE28134D7BAA0F4BB1E42FEFD0330EC3913F26C41ACABF9598722B7F;
> 1
>
> I compared them with the normal cookie string, I find all of the
> abnormal cookie string contain "1;"
> It is sure that the "1;" cause the Apache2::Cookie parser error.
> I wonder how and why the "1;" is added, and how to fix it.
>
> Thanks
>
> --
>
> *陈建春 | ChenJianchun*
> 傲游Web应用部
> E-mail: [email protected] <mailto:[email protected]>
>
> *Maxthon^® * --每个人的互联网中心! 上网从傲游开始!
> 傲游天下科技有限公司(中国) <http://www.maxthon.cn/> |
> www.maxthon.cn <http://www.maxthon.cn/>
>
> *诚信、创新、务实、奋斗!*
>
>