Pārlūkot izejas kodu

Missing \r\n after EHLO (#44)

Fix Missing \r\n after EHLO

Added missing \r\n after HELO response.
Clients would never care for the SIZE response
Philipp Resch 8 gadi atpakaļ
vecāks
revīzija
0a1bf91ef8
1 mainītis faili ar 5 papildinājumiem un 2 dzēšanām
  1. 5 2
      server.go

+ 5 - 2
server.go

@@ -13,9 +13,10 @@ import (
 
 	log "github.com/Sirupsen/logrus"
 
-	"github.com/flashmob/go-guerrilla/backends"
 	"sync"
 	"sync/atomic"
+
+	"github.com/flashmob/go-guerrilla/backends"
 )
 
 const (
@@ -281,12 +282,14 @@ func (server *server) handleClient(client *client) {
 		server.clientPool.GetActiveClientsCount(), time.Now().Format(time.RFC3339), runtime.NumGoroutine())
 
 	helo := fmt.Sprintf("250 %s Hello", sc.Hostname)
-	ehlo := fmt.Sprintf("250-%s Hello", sc.Hostname)
+	// ehlo is a multi-line reply and need additional \r\n at the end
+	ehlo := fmt.Sprintf("250-%s Hello\r\n", sc.Hostname)
 
 	// Extended feature advertisements
 	messageSize := fmt.Sprintf("250-SIZE %d\r\n", sc.MaxSize)
 	pipelining := "250-PIPELINING\r\n"
 	advertiseTLS := "250-STARTTLS\r\n"
+	// the last line doesn't need \r\n since string will be printed as a new line
 	help := "250 HELP"
 
 	if sc.TLSAlwaysOn {