Don't take down HTTP(S) server on connection errors (fixes #700)

This commit is contained in:
Jakob Borg
2014-09-18 11:45:48 +02:00
parent 97844603fc
commit 45af549897
3 changed files with 22 additions and 5 deletions

View File

@@ -96,8 +96,9 @@ func (l *DowngradingListener) Accept() (net.Conn, error) {
br := bufio.NewReader(conn)
bs, err := br.Peek(1)
if err != nil {
conn.Close()
return nil, err
// We hit a read error here, but the Accept() call succeeded so we must not return an error.
// We return the connection as is and let whoever tries to use it deal with the error.
return conn, nil
}
wrapper := &WrappedConnection{br, conn}