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

proposal: net/http: Expose underlying Conn in http.ResponseWriter? #13570

sbowman opened this issue Dec 10, 2015 · 2 comments


None yet
4 participants
Copy link

commented Dec 10, 2015

I'd like to be able to mark the outgoing response packets with TOS values to support QOS based on different incoming client requests. Would it be reasonable to expose the Conn in http.ResponseWriter? Or perhaps enable some other way to support TOS?


This comment has been minimized.

Copy link

commented Dec 10, 2015


This comment has been minimized.

Copy link

commented Dec 10, 2015

I'd rather not expose the conn. It leads to people being too clever and messing with the stream. CloseNotifier and Hijack are annoying enough to maintain.

I think this is a bizarre enough requirement (I've never head of anybody ever setting TOS based on the HTTP request) that it's not worth supporting directly. I think you can just write a net.Listener implementation that tracks the underlying TCP conn fds, returns a RemoteAddr() that net/http puts in stringified form in Request.RemoteAddr, then an http.Handler wrapper which unwraps that RemoteAddr string to find the TCP connection and resets RemoteAddr to its usual form.

It sounds kinda hacky, but so is the original problems, so it seems fitting.

@bradfitz bradfitz closed this Dec 10, 2015

@golang golang locked and limited conversation to collaborators Dec 14, 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.