Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: fix panic error message on Request.Body read after Hijack #20933
What version of Go are you using (
Yes, this was changed in Go 1.8.
After your call to Hijack, you're not supposed to read from Request.Body anymore. I'll keep this bug open to fix that error message.
After a hijack, you're expected to read from the returned bufio.Reader:
(That includes the 1 byte)
BTW, the time for Go 1.8 feedback was in December. We're currently wrapping up Go 1.9, which is almost out. If you could test Go 1.9beta2, that'd b egreat.
Is that explicitly documented anywhere?
I can confirm that rearranging the example so that it Hijacks only after fully reading the request seems to fix it: https://play.golang.org/p/akmrJbBnN6
We can make it panic with a more explicit and readable error message during Go 1.10, but document it for now. This has always been the case; it's not a new rule. Updates #20933 Change-Id: I53c1fefb47a8f4aae0bb32fa742afa3a2ed20e8a Reviewed-on: https://go-review.googlesource.com/50634 Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org> Reviewed-by: Emmanuel Odeke <email@example.com>