Prechádzať zdrojové kódy

Only ehlo should append \r\n

Helo returns with a single line, ehlo may have additional lines
Guerrilla Mail 8 rokov pred
rodič
commit
4f4d318eba
1 zmenil súbory, kde vykonal 3 pridanie a 1 odobranie
  1. 3 1
      server.go

+ 3 - 1
server.go

@@ -281,13 +281,15 @@ func (server *server) handleClient(client *client) {
 		sc.Hostname, Version, client.ID,
 		server.clientPool.GetActiveClientsCount(), time.Now().Format(time.RFC3339), runtime.NumGoroutine())
 
-	helo := fmt.Sprintf("250 %s Hello\r\n", sc.Hostname)
+	helo := 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 {