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: should Request.Write use Header["Host"] if Request.Host is unset? #4792

Closed
bradfitz opened this issue Feb 11, 2013 · 3 comments
Closed
Milestone

Comments

@bradfitz
Copy link
Contributor

See:
http://play.golang.org/p/toLUTjj_fE

The Host field is not written, since Request.Write(io.Writer) uses Request.Host, and not
Request.Header.Get("Host").

It's document that Request.Write uses the Host field, and it's listed first:

    http://golang.org/pkg/net/http/#Request.Write

Should Request.Write fall back to Request.Header.Get("Host") if Request.Host
is unset?
@rsc
Copy link
Contributor

rsc commented Feb 13, 2013

Comment 1:

That's probably an API change. I'm inclined to leave it as is.

@bradfitz
Copy link
Contributor Author

Comment 2:

Fine by me. Added a test to make sure we always do it that way, then:
https://golang.org/cl/7314093

Status changed to Started.

@bradfitz
Copy link
Contributor Author

Comment 3:

This issue was closed by revision cd56695.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 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

3 participants