forked from flashmob/go-guerrilla
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Parser captures quoted local-parts without the escape characters - mail.Address.String() know when to quote local-part, - server's `allowsHost` function is ipv6 address aware (addresses specified in the config will get normalized to their ipv6 simplest form, addresses parsed from RCPT and MAIL commands will have ipv6 normalized) - if `<postmaster>` is used in the RCPT TO (without a host), then new functionality was added to assume that the host is assumed to be the Hostname setting for the Server - HELO/EHLO argument validation. flashmob#200 - The “header” processor populates “Received:” headers wrongly. flashmob#198 - tiny bug in “p_redis.go”. flashmob#196 - “MimeHeaderDecode” (envelope.go) returns an incorrectly-spaced string. flashmob#195 - go-guerrilla cannot properly handle some valid addresses. flashmob#199
- Loading branch information
Showing
17 changed files
with
1,521 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,70 @@ func TestEncodingMimeHeaderDecode(t *testing.T) { | |
str = mail.MimeHeaderDecode("=?ISO-8859-1?Q?Andr=E9?= Pirard <[email protected]>") | ||
if strings.Index(str, "André Pirard") != 0 { | ||
t.Error("expecting André Pirard, got:", str) | ||
|
||
} | ||
|
||
str = mail.MimeHeaderDecode("=?ISO-8859-1?Q?Andr=E9?=\tPirard <[email protected]>") | ||
if strings.Index(str, "André\tPirard") != 0 { | ||
t.Error("expecting André Pirard, got:", str) | ||
|
||
} | ||
|
||
} | ||
|
||
// TestEncodingMimeHeaderDecodeEnding tests when the encoded word is at the end | ||
func TestEncodingMimeHeaderDecodeEnding(t *testing.T) { | ||
|
||
// plaintext at the beginning | ||
str := mail.MimeHeaderDecode("What about this one? =?ISO-8859-1?Q?Andr=E9?=") | ||
if str != "What about this one? André" { | ||
t.Error("expecting: What about this one? André, but got:", str) | ||
|
||
} | ||
|
||
// not plaintext at beginning | ||
str = mail.MimeHeaderDecode("=?ISO-8859-1?Q?Andr=E9?= What about this one? =?ISO-8859-1?Q?Andr=E9?=") | ||
if str != "André What about this one? André" { | ||
t.Error("expecting: André What about this one? André, but got:", str) | ||
|
||
} | ||
// plaintext at beginning corruped | ||
str = mail.MimeHeaderDecode("=?ISO-8859-1?B?Andr=E9?= What about this one? =?ISO-8859-1?Q?Andr=E9?=") | ||
if strings.Index(str, "=?ISO-8859-1?B?Andr=E9?= What about this one? André") != 0 { | ||
t.Error("expecting:=?ISO-8859-1?B?Andr=E9?= What about this one? André, but got:", str) | ||
|
||
} | ||
} | ||
|
||
// TestEncodingMimeHeaderDecodeBad tests the case of a malformed encoding | ||
func TestEncodingMimeHeaderDecodeBad(t *testing.T) { | ||
// bad base64 encoding, it should return the string unencoded | ||
str := mail.MimeHeaderDecode("=?ISO-8859-1?B?Andr=E9?=\tPirard <[email protected]>") | ||
if strings.Index(str, "=?ISO-8859-1?B?Andr=E9?=\tPirard <[email protected]>") != 0 { | ||
t.Error("expecting =?ISO-8859-1?B?Andr=E9?=\tPirard <[email protected]>, got:", str) | ||
|
||
} | ||
|
||
} | ||
|
||
func TestEncodingMimeHeaderDecodeNoSpace(t *testing.T) { | ||
// there is no space | ||
str := mail.MimeHeaderDecode("A =?ISO-8859-1?Q?Andr=E9?=WORLD IN YOUR POCKET") | ||
if str != "A AndréWORLD IN YOUR POCKET" { | ||
// in this case, if it's QP and ?= is found at the end then we can assume no space? | ||
t.Error("Did not get [A AndréWORLD IN YOUR POCKET]") | ||
} | ||
} | ||
|
||
func TestEncodingMimeHeaderDecodeMulti(t *testing.T) { | ||
|
||
str := mail.MimeHeaderDecode("=?iso-2022-jp?B?GyRCIVpLXEZ8Om89fCFbPEIkT0lUOk5NUSROJU0lPyROSn0bKEI=?= =?iso-2022-jp?B?GyRCJCxCPyQkJEckORsoQg==?=") | ||
if strings.Index(str, "【本日削除】実は不採用のネタの方が多いです") != 0 { | ||
t.Error("expecting 【本日削除】実は不採用のネタの方が多いです, got:", str) | ||
} | ||
|
||
str = mail.MimeHeaderDecode("=?iso-2022-jp?B?GyRCIVpLXEZ8Om89fCFbPEIkT0lUOk5NUSROJU0lPyROSn0bKEI=?= \t =?iso-2022-jp?B?GyRCJCxCPyQkJEckORsoQg==?=") | ||
if strings.Index(str, "【本日削除】実は不採用のネタの方が多いです") != 0 { | ||
t.Error("expecting 【本日削除】実は不採用のネタの方が多いです, got:", str) | ||
} | ||
} |
Oops, something went wrong.