mirror of
https://github.com/axllent/mailpit.git
synced 2025-01-14 02:33:13 +02:00
Add case-insensitive flags to regex'es (#411)
* Update smtpd.go: Adding case-insensitive flags to regex'es * Update smtpd_test.go
This commit is contained in:
parent
13027bf10b
commit
9f4908d11d
@ -27,8 +27,8 @@ import (
|
||||
var (
|
||||
// Debug `true` enables verbose logging.
|
||||
Debug = false
|
||||
rcptToRE = regexp.MustCompile(`[Tt][Oo]: ?<([^<>\v]+)>( |$)(.*)?`)
|
||||
mailFromRE = regexp.MustCompile(`[Ff][Rr][Oo][Mm]: ?<(|[^<>\v]+)>( |$)(.*)?`) // Delivery Status Notifications are sent with "MAIL FROM:<>"
|
||||
rcptToRE = regexp.MustCompile(`(?i)TO: ?<([^<>\v]+)>( |$)(.*)?`)
|
||||
mailFromRE = regexp.MustCompile(`(?i)FROM: ?<(|[^<>\v]+)>( |$)(.*)?`) // Delivery Status Notifications are sent with "MAIL FROM:<>"
|
||||
|
||||
// extract mail size from 'MAIL FROM' parameter
|
||||
mailFromSizeRE = regexp.MustCompile(`(?U)(^| |,)[Ss][Ii][Zz][Ee]=(.*)($|,| )`)
|
||||
|
@ -84,8 +84,8 @@ func TestCmdHELO(t *testing.T) {
|
||||
|
||||
// Verify that HELO resets the current transaction state like RSET.
|
||||
// RFC 2821 section 4.1.4 says EHLO should cause a reset, so verify that HELO does it too.
|
||||
cmdCode(t, conn, "MAIL FROM:<sender@example.com>", "250")
|
||||
cmdCode(t, conn, "RCPT TO:<recipient@example.com>", "250")
|
||||
cmdCode(t, conn, "mail from:<sender@example.com>", "250") // Also testing case-insensitivity
|
||||
cmdCode(t, conn, "rcpt to:<recipient@example.com>", "250")
|
||||
cmdCode(t, conn, "HELO host.example.com", "250")
|
||||
cmdCode(t, conn, "DATA", "503")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user