From: Brad Fitzpatrick Date: Thu, 4 Jun 2015 19:57:53 +0000 (-0700) Subject: net/http: the Set-Cookie Expiration time zone should be GMT, not UTC X-Git-Tag: go1.5beta1~363 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d751be9f98120cc9d54b986f1fb09249dc2e6f3a;p=gostls13.git net/http: the Set-Cookie Expiration time zone should be GMT, not UTC Per RFC 6265. Change-Id: I2b6b145f5d057f96509332509d722602ed9e2bbd Reviewed-on: https://go-review.googlesource.com/10711 Reviewed-by: Brett Slatkin Reviewed-by: Andrew Gerrand Run-TryBot: Brad Fitzpatrick --- diff --git a/src/net/http/cookie.go b/src/net/http/cookie.go index a0d0fdbbd0..635a265706 100644 --- a/src/net/http/cookie.go +++ b/src/net/http/cookie.go @@ -156,7 +156,7 @@ func (c *Cookie) String() string { } } if c.Expires.Unix() > 0 { - fmt.Fprintf(&b, "; Expires=%s", c.Expires.UTC().Format(time.RFC1123)) + fmt.Fprintf(&b, "; Expires=%s", c.Expires.UTC().Format(TimeFormat)) } if c.MaxAge > 0 { fmt.Fprintf(&b, "; Max-Age=%d", c.MaxAge) diff --git a/src/net/http/cookie_test.go b/src/net/http/cookie_test.go index 1ec993e935..bcad88c012 100644 --- a/src/net/http/cookie_test.go +++ b/src/net/http/cookie_test.go @@ -52,6 +52,10 @@ var writeSetCookiesTests = []struct { &Cookie{Name: "cookie-8", Value: "eight", Domain: "::1"}, "cookie-8=eight", }, + { + &Cookie{Name: "cookie-9", Value: "expiring", Expires: time.Unix(1257894000, 0)}, + "cookie-9=expiring; Expires=Tue, 10 Nov 2009 23:00:00 GMT", + }, // The "special" cookies have values containing commas or spaces which // are disallowed by RFC 6265 but are common in the wild. {