]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: make startBackgroundRead panic if hijacked
authorKunpei Sakai <namusyaka@gmail.com>
Tue, 29 Aug 2017 09:56:59 +0000 (18:56 +0900)
committerTom Bergan <tombergan@google.com>
Thu, 31 Aug 2017 17:25:30 +0000 (17:25 +0000)
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>

src/net/http/server.go

index 9b3efecb59c26390a3d6994c988af464cd7f7e91..d29d3a462a4f3af79bca578c717260a56229146d 100644 (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() {