From ea4492505d629e105e07d94901256d53eef88c77 Mon Sep 17 00:00:00 2001 From: Tung Lam <53996158+tunglambk@users.noreply.github.com> Date: Mon, 12 Oct 2026 10:34:20 +0000 Subject: [PATCH] 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. --- internal/netutil/multi_listener.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/netutil/multi_listener.go b/internal/netutil/multi_listener.go index 4e9c8fa2..1068155e 100644 --- a/internal/netutil/multi_listener.go +++ b/internal/netutil/multi_listener.go @@ -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