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: request host includes port, but cookie host must not include port #4787

Closed
gopherbot opened this issue Feb 11, 2013 · 1 comment
Closed
Milestone

Comments

@gopherbot
Copy link

by daniel.r.heath:

$ go version
go version go1.0.3

I'm writing a web application which uses cookies, using the standard library http
support, running on port 8008.

The problem is that 'net/http'.Request.Host returns a host like 'my.app.local:8008'. 

The host and port parts of the http request should be separately available for use with
cookies

eg: http://play.golang.org/p/cL9UevZuY5
@bradfitz
Copy link
Contributor

Comment 1:

Can't you just use net.SplitHostPort, or easier: not set the domain on the cookie?  It
doesn't seem worth it to add more fields to the Request.
It's already documented to be of the form "host:port":
http://tip.golang.org/pkg/net/http/#Request
    // The host on which the URL is sought.
    // Per RFC 2616, this is either the value of the Host: header
    // or the host name given in the URL itself.
    // It may be of the form "host:port".
    Host string
Closing this bug for now, but feel free to comment if I've missed something.

Status changed to WorkingAsIntended.

@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