From: Brad Fitzpatrick Date: Thu, 23 Feb 2012 04:51:53 +0000 (+1100) Subject: net/http: some more cookie tests X-Git-Tag: weekly.2012-02-22~1 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a5b59645240e2e7b5304d5d869acb801f2b7ef00;p=gostls13.git net/http: some more cookie tests Including a commented-out test we might tackle later, after seeing what browsers do. R=dsymonds, rsc CC=golang-dev https://golang.org/cl/5694045 --- diff --git a/src/pkg/net/http/cookie_test.go b/src/pkg/net/http/cookie_test.go index 712350dfce..1e9186a058 100644 --- a/src/pkg/net/http/cookie_test.go +++ b/src/pkg/net/http/cookie_test.go @@ -128,6 +128,34 @@ var readSetCookiesTests = []struct { Raw: "NID=99=YsDT5i3E-CXax-; expires=Wed, 23-Nov-2011 01:05:03 GMT; path=/; domain=.google.ch; HttpOnly", }}, }, + { + Header{"Set-Cookie": {".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"}}, + []*Cookie{{ + Name: ".ASPXAUTH", + Value: "7E3AA", + Path: "/", + Expires: time.Date(2012, 3, 7, 14, 25, 6, 0, time.UTC), + RawExpires: "Wed, 07-Mar-2012 14:25:06 GMT", + HttpOnly: true, + Raw: ".ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly", + }}, + }, + { + Header{"Set-Cookie": {"ASP.NET_SessionId=foo; path=/; HttpOnly"}}, + []*Cookie{{ + Name: "ASP.NET_SessionId", + Value: "foo", + Path: "/", + HttpOnly: true, + Raw: "ASP.NET_SessionId=foo; path=/; HttpOnly", + }}, + }, + + // TODO(bradfitz): users have reported seeing this in the + // wild, but do browsers handle it? RFC 6265 just says "don't + // do that" (section 3) and then never mentions header folding + // again. + // Header{"Set-Cookie": {"ASP.NET_SessionId=foo; path=/; HttpOnly, .ASPXAUTH=7E3AA; expires=Wed, 07-Mar-2012 14:25:06 GMT; path=/; HttpOnly"}}, } func toJSON(v interface{}) string {