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

parseURL() seems to lose the Host as its using Opaque instead of Path? #147

Closed
jstrachan opened this issue Jul 6, 2016 · 5 comments
Closed

Comments

@jstrachan
Copy link

while using websocket I was finding the host and port were getting stripped from the URL I was using. It looks like the parseURL() function is updating the Opaque value rather than the Path; was that intentional? A PR is on its way if it helps

jstrachan added a commit to jstrachan/websocket that referenced this issue Jul 6, 2016
@garyburd
Copy link
Contributor

garyburd commented Jul 6, 2016

Opaque is intentionally set to work around a long-standing bug in net/url.

What is the specific error that you encountered? Did the client fail to connect to the correct host and port?

@jstrachan
Copy link
Author

Ah ok thanks! Yeah I was seeing the host/port zapped from the URL so figured it was a bug. Though maybe it only looks like a bug in that the host name is in the URL; it just never appears if you use url.String()?

@garyburd
Copy link
Contributor

garyburd commented Jul 6, 2016

The workaround breaks URL.String().

@garyburd
Copy link
Contributor

garyburd commented Jul 7, 2016

Are you accessing the URL from a proxy function or from resp.Request.URL where resp is the second return value from Dialer.Dial? Is it important that String() print the correct URL?

The net/url bug is fixed in Go 1.6. I plan to replace parseURL with the standard net/url parser when all users of the package move to Go 1.6 or later. That's probably two or three years.

@jstrachan
Copy link
Author

TBH I think this was probably me thinking there was a bug as I was seeing the host/port disappear in logging output (due to how String() doesn't show host if opaque is set); when it probably doesn't affect the actual behaviour of the code. So lets close I think! Sorry for the noise

@gorilla gorilla locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants