]> Cypherpunks repositories - gostls13.git/commit
exp/cookiejar: store cookies under TLD+1 on nil public suffix list
authorVolker Dobler <dr.volker.dobler@gmail.com>
Tue, 19 Feb 2013 08:12:36 +0000 (19:12 +1100)
committerNigel Tao <nigeltao@golang.org>
Tue, 19 Feb 2013 08:12:36 +0000 (19:12 +1100)
commit6ab113531b49621394dbd274c44bb583ded1dc45
tree259bd09f0369f887603f76d5deb6ccb153ef96f3
parent68ff170ebece48b7fbef3c14c1514811a4d6c370
exp/cookiejar: store cookies under TLD+1 on nil public suffix list

The current implementation would store all cookies received from
any .com domain under "com" in the entries map if a nil public
suffix list is used in constructing the Jar. This is inefficient.

This CL uses the TLD+1 of the domain if the public suffix list
is nil which has two advantages:
 - It uses the entries map efficiently.
 - It prevents a host foo.com to set cookies for bar.com.
   (It may set the cookie, but it won't be returned to bar.com.)
A domain like www.british-library.uk may still set a domain
cookie for .british-library.uk in this case.

The behavior for a non-nil public suffix list is unchanged, cookies
are stored under eTLD+1 in this case.

R=nigeltao
CC=golang-dev
https://golang.org/cl/7312105
src/pkg/exp/cookiejar/jar.go
src/pkg/exp/cookiejar/jar_test.go