]> Cypherpunks repositories - gostls13.git/commitdiff
net/mail: accept UT as a timezone
authorIan Lance Taylor <iant@golang.org>
Mon, 28 Mar 2022 17:18:03 +0000 (10:18 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 28 Mar 2022 21:59:25 +0000 (21:59 +0000)
Fixes #39906

Change-Id: I8fcaf4c1ccc4131d770cff08d9c80f520885a6b5
Reviewed-on: https://go-review.googlesource.com/c/go/+/396214
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com>
src/net/mail/message.go
src/net/mail/message_test.go

index 5770e3d8dc6db52ccc701a2724ed977d03bb22ae..61a3a26b012a41c57fb37f6f81bef400e5dc1fed 100644 (file)
@@ -79,7 +79,7 @@ func buildDateLayouts() {
        years := [...]string{"2006", "06"} // year = 4*DIGIT / 2*DIGIT
        seconds := [...]string{":05", ""}  // second
        // "-0700 (MST)" is not in RFC 5322, but is common.
-       zones := [...]string{"-0700", "MST"} // zone = (("+" / "-") 4DIGIT) / "GMT" / ...
+       zones := [...]string{"-0700", "MST", "UT"} // zone = (("+" / "-") 4DIGIT) / "UT" / "GMT" / ...
 
        for _, dow := range dows {
                for _, day := range days {
index 41c54b868777049d539575ca4860063360277b92..61e50ccfd5c8447816b73d74aede200703b201b1 100644 (file)
@@ -265,11 +265,21 @@ func TestDateParsingCFWS(t *testing.T) {
                {
                        "Tue, 26 May 2020 14:04:40 UT",
                        time.Date(2020, 05, 26, 14, 04, 40, 0, time.UTC),
-                       false,
+                       true,
                },
                {
                        "Thu, 21 May 2020 14:04:40 UT",
                        time.Date(2020, 05, 21, 14, 04, 40, 0, time.UTC),
+                       true,
+               },
+               {
+                       "Tue, 26 May 2020 14:04:40 XT",
+                       time.Date(2020, 05, 26, 14, 04, 40, 0, time.UTC),
+                       false,
+               },
+               {
+                       "Thu, 21 May 2020 14:04:40 XT",
+                       time.Date(2020, 05, 21, 14, 04, 40, 0, time.UTC),
                        false,
                },
                {