diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2012-02-23 15:51:53 +1100 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2012-02-23 15:51:53 +1100 |
commit | a5b59645240e2e7b5304d5d869acb801f2b7ef00 (patch) | |
tree | a5a42fdccd9cf263585b9b783984a75c961529ec | |
parent | 6c20f5c0135483da1127d15e724b2bf1608833d7 (diff) | |
download | go-a5b59645240e2e7b5304d5d869acb801f2b7ef00.tar.gz go-a5b59645240e2e7b5304d5d869acb801f2b7ef00.zip |
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
-rw-r--r-- | src/pkg/net/http/cookie_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
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 { |