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: make interface for verbatim transmission of http responses #8986

Closed
DanielMorsing opened this issue Oct 23, 2014 · 4 comments
Closed
Milestone

Comments

@DanielMorsing
Copy link
Contributor

Right now there are a couple of issues when using net/http as a transparent proxy

- There's no way to write trailer headers.
- There's no way to provide a custom status text, E.g. "420 Enhance Your Calm"
- Content-Type header is added on every response.

Being able to give the ResponseWriter a *Response gets around all of these problems.
Something like 

type Responder interface {
    Respond(*Response) error
}

in net/http would make it possible to use the server as a transparent proxy.
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main.

@bradfitz
Copy link
Contributor

Comment 2:

Trailer Headers is issue #7759. There's nothing special about proxies here, other than
that once issue #7759 is fixed, httputil.ReverseProxy should perhaps use it.
Custom Status Text is marginally useful and marginally harmful: it shouldn't matter.
Correct implementations should not be reading like humans. "The Reason-Phrase is
intended to give a short textual description of the Status-Code. The Status-Code is
intended for use by automata and the Reason-Phrase is intended for the human user. The
client is not required to examine or display the Reason- Phrase." Until I'm hear a
really great reason, I'd prefer to not clutter up net/http.
Please file a separate bug just about omitting Content-Type in responses.
I won't be adding something so large of an interface as Responder, though. It overlaps
too much with other stuff and would be confusing, and hard to support over time.

Status changed to WontFix.

@DanielMorsing
Copy link
Contributor Author

Comment 3:

I see your point about Responder. Too wide reaching.
I've filled issue #8990 for custom status texts.

@bradfitz
Copy link
Contributor

Comment 4:

I asked that you file a bug for omitting Content-Type, not status text.  But that works
too. I've filed issue #8992 for the Content-Type thing.

@bradfitz bradfitz modified the milestone: Go1.5 Dec 16, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants