From 915126bb911d0cb40f02e9775f2cf7c726f47299 Mon Sep 17 00:00:00 2001 From: Kunpei Sakai Date: Tue, 29 Aug 2017 18:56:59 +0900 Subject: [PATCH] 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 --- src/net/http/server.go | 3 +++ 1 file changed, 3 insertions(+) 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() { -- 2.50.0