• Brad Fitzpatrick's avatar
    net/http: make sure Hijack's bufio.Reader includes pre-read background byte · b2a3b54b
    Brad Fitzpatrick authored
    Previously, if the Hijack called stopped the background read call
    which read a byte, that byte was sitting in memory, buffered, ready to
    be Read by Hijack's returned bufio.Reader, but it wasn't yet in the
    bufio.Reader's buffer itself, so bufio.Reader.Buffered() reported 1
    byte fewer.
    
    This matters for callers who wanted to stitch together any buffered
    data (with bufio.Reader.Peek(bufio.Reader.Buffered())) with Hijack's
    returned net.Conn. Otherwise there was no way for callers to know a
    byte was read.
    
    Change-Id: Id7cb0a0a33fe2f33d79250e13dbaa9c0f7abba13
    Reviewed-on: https://go-review.googlesource.com/35232
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarJoe Tsai <thebrokentoaster@gmail.com>
    b2a3b54b
server.go 91.9 KB