Early detection of non http traffic to match web server behavior

pull/2545/head
Shelikhoo 2020-06-03 15:44:25 +08:00
parent 087a62ef3d
commit 221a13e658
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316
1 changed files with 4 additions and 0 deletions

View File

@ -89,6 +89,10 @@ func (h *HeaderReader) Read(reader io.Reader) (*buf.Buffer, error) {
leftover := buffer.BytesFrom(-lenEnding)
buffer.Clear()
copy(buffer.Extend(lenEnding), leftover)
if _, err := readRequest(bufio.NewReader(bytes.NewReader(headerBuf.Bytes())), false); err != io.ErrUnexpectedEOF {
return nil, err
}
}
}