]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: the Set-Cookie Expiration time zone should be GMT, not UTC
authorBrad Fitzpatrick <bradfitz@golang.org>
Thu, 4 Jun 2015 19:57:53 +0000 (12:57 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 4 Jun 2015 20:41:53 +0000 (20:41 +0000)
Per RFC 6265.

Change-Id: I2b6b145f5d057f96509332509d722602ed9e2bbd
Reviewed-on: https://go-review.googlesource.com/10711
Reviewed-by: Brett Slatkin <bslatkin@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>

src/net/http/cookie.go
src/net/http/cookie_test.go

index a0d0fdbbd074436dc7eb1f328b02836b606b26a1..635a265706a9812be1e65a547498f60dc8824f97 100644 (file)
@@ -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)
index 1ec993e935140b613761818c5ff8ec5b6a2c4c4c..bcad88c012120995bf9c396bc53a9617de86b1a6 100644 (file)
@@ -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.
        {