From: Kunpei Sakai Date: Tue, 29 Aug 2017 09:56:59 +0000 (+0900) Subject: net/http: make startBackgroundRead panic if hijacked X-Git-Tag: go1.10beta1~1247 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=915126bb911d0cb40f02e9775f2cf7c726f47299;p=gostls13.git net/http: make startBackgroundRead panic if hijacked Fixes #20933 Change-Id: I827c8d265674a7448c51c1da991e9b3b4501ba11 Reviewed-on: https://go-review.googlesource.com/59850 Run-TryBot: Tom Bergan Reviewed-by: Tom Bergan TryBot-Result: Gobot Gobot --- diff --git a/src/net/http/server.go b/src/net/http/server.go index 9b3efecb59..d29d3a462a 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -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() {