summaryrefslogtreecommitdiff
path: root/src/pkg/net/mail
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2012-06-14 13:23:46 +0200
committerOndřej Surý <ondrej@sury.org>2012-06-14 13:23:46 +0200
commit917c5fb8ec48e22459d77e3849e6d388f93d3260 (patch)
tree9c23734a6ffd4d2a8ac99502eda3cc812a8b130b /src/pkg/net/mail
parent0003ee229fd33ff46cb5f2fe1e35f5c0284debc4 (diff)
downloadgolang-917c5fb8ec48e22459d77e3849e6d388f93d3260.tar.gz
Imported Upstream version 1.0.2upstream/1.0.2
Diffstat (limited to 'src/pkg/net/mail')
-rw-r--r--src/pkg/net/mail/message.go11
-rw-r--r--src/pkg/net/mail/message_test.go5
2 files changed, 11 insertions, 5 deletions
diff --git a/src/pkg/net/mail/message.go b/src/pkg/net/mail/message.go
index 0917bbedf..b610ccf3f 100644
--- a/src/pkg/net/mail/message.go
+++ b/src/pkg/net/mail/message.go
@@ -69,11 +69,12 @@ var dateLayouts []string
func init() {
// Generate layouts based on RFC 5322, section 3.3.
- dows := [...]string{"", "Mon, "} // day-of-week
- days := [...]string{"2", "02"} // day = 1*2DIGIT
- years := [...]string{"2006", "06"} // year = 4*DIGIT / 2*DIGIT
- seconds := [...]string{":05", ""} // second
- zones := [...]string{"-0700", "MST"} // zone = (("+" / "-") 4DIGIT) / "GMT" / ...
+ dows := [...]string{"", "Mon, "} // day-of-week
+ days := [...]string{"2", "02"} // day = 1*2DIGIT
+ 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", "-0700 (MST)"} // zone = (("+" / "-") 4DIGIT) / "GMT" / ...
for _, dow := range dows {
for _, day := range days {
diff --git a/src/pkg/net/mail/message_test.go b/src/pkg/net/mail/message_test.go
index 671ff2efa..fd17eb414 100644
--- a/src/pkg/net/mail/message_test.go
+++ b/src/pkg/net/mail/message_test.go
@@ -95,6 +95,11 @@ func TestDateParsing(t *testing.T) {
"21 Nov 97 09:55:06 GMT",
time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("GMT", 0)),
},
+ // Commonly found format not specified by RFC 5322.
+ {
+ "Fri, 21 Nov 1997 09:55:06 -0600 (MDT)",
+ time.Date(1997, 11, 21, 9, 55, 6, 0, time.FixedZone("", -6*60*60)),
+ },
}
for _, test := range tests {
hdr := Header{