1
0
Fork 0

Log remote IP address when reading a request fails.

This commit is contained in:
Solderpunk 2020-07-03 11:16:07 +02:00
parent 2241302856
commit 48aed1398d

View file

@ -141,7 +141,7 @@ func readRequest(conn net.Conn, log *LogEntry, errorLog *log.Logger) (*url.URL,
log.Status = 59
return nil, errors.New("Request too long")
} else if err != nil {
errorLog.Println("Error reading request: " + err.Error())
errorLog.Println("Error reading request from " + conn.RemoteAddr().String() + ": " + err.Error())
conn.Write([]byte("40 Unknown error reading request!\r\n"))
log.Status = 40
return nil, errors.New("Error reading request")