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: JoinHostPort should not add [ ] when the host is ipv6 and it is surrounded by brackets #26006
Comments
The function works as documented -
Checking for /cc @bradfitz. |
CC @mikioh |
@agnivade I wonder why it's a breaking change because no matter you give the ipv6 has |
@agnivade like you say the users can check by themselves, but if the |
I don't think it's legal to have a hostname with brackets. I think they're only valid in the host:port form. |
@bradfitz yeah but in golang, when we use |
@Sherlock-Holo - It's a breaking change because you want it to return |
@agnivade yes some programs check if |
@agnivade, I'm not concerned about breaking people who depend on getting bogus I'm just not seeing how somebody ends up with brackets around an IPv6 literal without a port. Where do such values come from that you then need to call |
for example, som people write |
@Sherlock-Holo, what other software accepts an IP (without a port) with brackets? |
At most time, config file is written by human. Some guys think writing an ipv6 wrapped with brackets is a good idea because if we open a website on chrome with ipv6 address instead of hostname, they should make the ipv6 wrapped with brackets. Others think ipv6 just an ip address why ipv6 is different from ipv4, so they write ipv6 without brackets. |
JoinHostPort joins a host and a port. [ipv6addr] is not a host. Sorry. |
oh what is HOST? what is the definition of host???
Russ Cox <notifications@github.com> 于 2018年6月26日周二 04:05写道:
… Closed #26006 <#26006>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#26006 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AJoPKSDMTVNv-TpJlyBIWxK4JYZ61u1rks5uAUKZgaJpZM4UzV3u>
.
|
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.10.3 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?What did you do?
https://play.golang.org/p/faeZpo0P020
What did you expect to see?
What did you see instead?
I think JoinHostPort can identify this host is an ipv6 address, and we can use
strings.HasPrefix
andstrings.HasSuffix
to check if the ipv6 address already has the bracket. If it already has brackets, I think JoinHostPort should not add it againThe text was updated successfully, but these errors were encountered: