1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:55:01 -07:00

net/http: make startBackgroundRead panic if hijacked

Fixes #20933

Change-Id: I827c8d265674a7448c51c1da991e9b3b4501ba11
Reviewed-on: https://go-review.googlesource.com/59850
Run-TryBot: Tom Bergan <tombergan@google.com>
Reviewed-by: Tom Bergan <tombergan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Kunpei Sakai 2017-08-29 18:56:59 +09:00 committed by Tom Bergan
parent 074547a5ce
commit 915126bb91

View File

@ -729,6 +729,9 @@ func (cr *connReader) Read(p []byte) (n int, err error) {
cr.lock()
if cr.inRead {
cr.unlock()
if cr.conn.hijacked() {
panic("invalid Body.Read call. After hijacked, the original Request must not be used")
}
panic("invalid concurrent Body.Read call")
}
if cr.hitReadLimit() {