Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: Response.Write ignores Proto field and always uses HTTP as protocol specifier #9304

brutella opened this issue Dec 13, 2014 · 1 comment


None yet
3 participants
Copy link

commented Dec 13, 2014

I use http.Response to create packets

resp := new(http.Response)
resp.Status = "200 OK"
resp.StatusCode = http.StatusOK
resp.ProtoMajor = 1
resp.ProtoMinor = 0
resp.Proto = "EVENT/1.0"

I set the Proto field, but at the end the written bytes still contain HTTP/1.0 200 OK because that's hardcoded in response.go


This comment has been minimized.

Copy link

commented Dec 13, 2014

Sorry, it's true that the net/http package is an HTTP package and assumes that the thing it's speaking is HTTP.

If you want to speak a different protocol, you'll need to use or write a different package.

@bradfitz bradfitz closed this Dec 13, 2014

@golang golang locked and limited conversation to collaborators Jun 25, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.