AnyEvent::HTTP and "bad" cookies

Vladimir V. Perepelitsa inthrax at gmail.com
Sat Jun 19 12:13:58 CEST 2010


On Sat, Jun 19, 2010 at 10:29 AM, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Fri, Jun 18, 2010 at 07:03:49PM +0400, Mons Anderson <mons at cpan.org> wrote:
>> On Friday 18 June 2010 18:17:17 Marc Lehmann wrote:
>> > > Current AE::HTTP's cookie parser implementation works wrong:
>> >
>> > It follows the official standard - it would help the dicussion if you
>> > wouldn't confuse it with words such as "wrong", when, in fact, the
>> > implementation follows the RFC _and_ the netscape specification.
>>
>> Oh, sorry for the confusion.
>> Of course I forgot to quote "wrong".
>>
>> I.e. I mean not like browsers do it.
>
> I am not sure what you are after - cookie parsing differs significantly
> between browsers, and ae::http certainly does it "like browsers do".
>

I want to not agree.

Take a site, for example, http://my.ebay.com and navigate to it using
your default version of AE::HTTP, my patched version, and any browser
(I've used firefox)

with firefox i got in headers

Set-Cookie: ebay=%5Esbf%3D%23%5E; Domain=.ebay.com; Path=/

Set-Cookie: dp1=bpbf/%2344dfdca7b^u1p/QEBfX0BAX19AQA**4dfdca7b^;
Domain=.ebay.com; Expires=Mon, 18-Jun-2012 10:07:55 GMT; Path=/

Set-Cookie: s=BAQAAASkfJ/I7AAWAAPgAIEwd6Hs0ZmFkYzYwZjEyOTBhMDZjMjEzNzY2MjdmZmUzOWJhZgASAApMHeh7dGVzdENvb2tpZQBjNZ9TMvNezhx67Njy1pOUO8YE;Domain=.ebay.com;Path=/;
HttpOnly

Set-Cookie: nonsession=CgADKACBVgph7NGZhZGM2MGYxMjkwYTA2YzIxMzc2NjI3ZmZlMzliYWYAywABTByeAzGY2XHr;
Domain=.ebay.com; Expires=Sun, 19-Jun-2011 10:07:55 GMT; Path=/

Set-Cookie: cid=joseEKdq; Domain=.ebay.com; Expires=Sun, 19-Jun-2011
10:07:55 GMT; Path=/


With patched version of AE::HTTP I got cookie_jar hash:

{
  version => 1,
  ".ebay.com" => {
    "/" => {
      ebay => {
        value => "^sbf=#^"
      },
      nonsession => {
        value =>
"CgADKACBVgpcxNGZhOGJiN2MxMjkwYTA0MGIxNzAzZjQwZmZlMTIyMzEAywABTBycuTGdn3T4",
        expires => "Sun, 19-Jun-2011 10:02:25 GMT"
      },
      cid => {
        value => "1a0XuL4j",
        expires => "Sun, 19-Jun-2011 10:02:25 GMT"
      },
      dp1 => {
        value => "bpbf/#44dfdc931^u1p/QEBfX0BAX19AQA**4dfdc931^",
        expires => "Mon, 18-Jun-2012 10:02:25 GMT"
      },
      s => {
        value =>
"BAQAAASkfJ/I7AAWAAPgAIEwd5zE0ZmE4YmI3YzEyOTBhMDQwYjE3MDNmNDBmZmUxMjIzMQASAApMHecxdGVzdENvb2tpZWh6AznmYp81Q80CWZIEbXPb0/Wl"
      }
    }
  }
}

with default AE::HTTP I got

{
  version => 1,
  "signin.ebay.com" => {
    "/" => {
      ebay => {
        value => "%5Esbf%3D%23%5E",
        Path => "/",
        Domain => ".ebay.com"
      },
      dp1 => {
        value => "bpbf/%2344dfdc96f^u1p/QEBfX0BAX19AQA**4dfdc96f^",
        Domain => ".ebay.com",
        Expires => "Mon"
      }
    }
  }
}

Expires => "Mon" not looks good, and rest of cookies are ignored.

-- 
Best wishes,
Vladimir V. Perepelitsa aka Mons Anderson
<inthrax at gmail.com>, <mons at cpan.org>



More information about the anyevent mailing list