docs(netutil): correct the comment on handing sniffed bytes to the handshake

The comment claimed the short read's error is carried to the next call. It
is not: it is returned when nothing was read, and the next read of the
connection produces it again for both EOF and an expired deadline.
This commit is contained in:
Tung Lam
2026-10-12 10:34:20 +00:00
parent b939fc8cc6
commit ea4492505d
+2 -2
View File
@@ -430,8 +430,8 @@ func (c *plaintextHTTPConn) Read(p []byte) (int, error) {
return 0, errPlaintextHTTPOnTLS
}
// Hand the sniffed bytes to the handshake and carry a short
// read's error over to the next call.
// Hand the sniffed bytes to the handshake. After a short read, the
// next read of the connection returns the error again.
c.prefix = hdr[:n]
if err != nil && n == 0 {
return 0, err