Browse Source

resolve conflicting changes from master

flashmob 5 years ago
parent
commit
dc792e973c
6 changed files with 11 additions and 14 deletions
  1. 2 4
      mail/envelope.go
  2. 1 1
      mail/smtp/address.go
  3. 1 1
      mail/smtp/address_test.go
  4. 5 5
      mail/smtp/parse.go
  5. 1 2
      mail/smtp/parse_test.go
  6. 1 1
      server_test.go

+ 2 - 4
mail/envelope.go

@@ -92,14 +92,12 @@ func (a *Address) IsPostmaster() bool {
 	}
 	}
 	return false
 	return false
 }
 }
-var ap = mail.AddressParser{}
-var apLock sync.Mutex // guards mail.AddressParser
 
 
 // NewAddress takes a string of an RFC 5322 address of the
 // NewAddress takes a string of an RFC 5322 address of the
 // form "Gogh Fir <[email protected]>" or "[email protected]".
 // form "Gogh Fir <[email protected]>" or "[email protected]".
 func NewAddress(str string) (*Address, error) {
 func NewAddress(str string) (*Address, error) {
-	apLock.Lock()
-	defer apLock.Unlock()
+
+	var ap smtp.RFC5322
 	l, err := ap.Address([]byte(str))
 	l, err := ap.Address([]byte(str))
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err

+ 1 - 1
mail/smtp/address.go

@@ -1,4 +1,4 @@
-package rfc5321
+package smtp
 
 
 import (
 import (
 	"errors"
 	"errors"

+ 1 - 1
mail/smtp/address_test.go

@@ -1,4 +1,4 @@
-package rfc5321
+package smtp
 
 
 import (
 import (
 	"testing"
 	"testing"

+ 5 - 5
mail/smtp/parse.go

@@ -21,6 +21,7 @@ const (
 	// The minimum total number of recipients that must be buffered is 100
 	// The minimum total number of recipients that must be buffered is 100
 	LimitRecipients = 100
 	LimitRecipients = 100
 )
 )
+
 type PathParam []string
 type PathParam []string
 
 
 type TransportType int
 type TransportType int
@@ -51,13 +52,12 @@ func (p PathParam) Transport() TransportType {
 
 
 var atExpected = errors.New("@ expected as part of mailbox")
 var atExpected = errors.New("@ expected as part of mailbox")
 
 
-
 // Parse Email Addresses according to https://tools.ietf.org/html/rfc5321
 // Parse Email Addresses according to https://tools.ietf.org/html/rfc5321
 type Parser struct {
 type Parser struct {
-	NullPath  bool
-	LocalPart string
-	LocalPartQuotes bool   // does the local part need quotes?
-	Domain    string
+	NullPath        bool
+	LocalPart       string
+	LocalPartQuotes bool // does the local part need quotes?
+	Domain          string
 	IP              net.IP
 	IP              net.IP
 
 
 	ADL        []string
 	ADL        []string

+ 1 - 2
mail/smtp/parse_test.go

@@ -647,7 +647,6 @@ func TestHelo(t *testing.T) {
 	}
 	}
 }
 }
 
 
-
 func TestTransport(t *testing.T) {
 func TestTransport(t *testing.T) {
 
 
 	path := PathParam([]string{"BODY", "8bitmime"})
 	path := PathParam([]string{"BODY", "8bitmime"})
@@ -673,4 +672,4 @@ func TestTransport(t *testing.T) {
 	if transport != TransportTypeUnspecified {
 	if transport != TransportTypeUnspecified {
 		t.Error("transport was not unspecified")
 		t.Error("transport was not unspecified")
 	}
 	}
-}
+}

+ 1 - 1
server_test.go

@@ -521,7 +521,7 @@ func sendMessage(greet string, TLS bool, w *textproto.Writer, t *testing.T, line
 	}
 	}
 	line, _ = r.ReadLine()
 	line, _ = r.ReadLine()
 
 
-	if err := w.PrintfLine("Subject: Test subject\r\n\r\nHello Sir,\nThis is a test.\r\n."); err != nil {
+	if err := w.PrintfLine("Subject: Test subject\r\n\r\nHello Sir,\nThis is a test.\r\n.\r"); err != nil {
 		t.Error(err)
 		t.Error(err)
 	}
 	}
 	line, _ = r.ReadLine()
 	line, _ = r.ReadLine()