You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version)?
go version go1.8.1 darwin/amd64
What operating system and processor architecture are you using (go env)?
macOS, amd64
What did you do?
I'm writing HTTP middleware that can check if underlying connection hijacked or not,
and if not - close connection with specific header and payload.
In go1.8 @bradfitz added some functionality to check if connection is hijacked without
unnecessary logs spam (#16456).
However, if connection is not hijacked, after call _, err := w.Write(nil)
http.StatusOK is written automatically, so it's not possible to write any other header.
Uh oh!
There was an error while loading. Please reload this page.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.8.1 darwin/amd64
What operating system and processor architecture are you using (
go env
)?macOS, amd64
What did you do?
I'm writing HTTP middleware that can check if underlying connection hijacked or not,
and if not - close connection with specific header and payload.
In go1.8 @bradfitz added some functionality to check if connection is hijacked without
unnecessary logs spam (#16456).
However, if connection is not hijacked, after call
_, err := w.Write(nil)
http.StatusOK is written automatically, so it's not possible to write any other header.
https://play.golang.org/p/LBnyyyijlk
So may be we can modify Write call to check
if lenData == 0
beforeif !w.wroteHeader
?Or we need hijack checking interface anyway.
What did you expect to see?
nothing in logs
What did you see instead?
http: multiple response.WriteHeader calls
The text was updated successfully, but these errors were encountered: