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

--resolve doesn't work with IPv6 addresses in bracket notation #2087

Closed
demonbane opened this issue Nov 16, 2017 · 4 comments
Closed

--resolve doesn't work with IPv6 addresses in bracket notation #2087

demonbane opened this issue Nov 16, 2017 · 4 comments

Comments

@demonbane
Copy link

I did this (host/ip are intentionally obfuscated)

curl -v --resolve 'myhost.domain.com:443:[dead:beef:1234:5678:8765:4321:feed:daed]' https://myhost.domain.com

I expected the following

For myhost.domain.com to resolve to [dead:beef:1234:5678:8765:4321:feed:daed], but what I got was:

curl -v --resolve 'myhost.domain.com:443:dead:beef:1234:5678:8765:4321:feeb:daed' https://myhost.domain.com
* Address in 'myhost.domain.com:443:[dead:beef:1234:5678:8765:4321:feed:daed]' found illegal!

If I specify the IPv6 address incorrectly, that is without the brackets, then it works as expected:

curl -v --resolve 'myhost.domain.com:443:dead:beef:1234:5678:8765:4321:feeb:daed' https://myhost.domain.com
* Added myhost.domain.com:443:dead:beef:1234:5678:8765:4321:feeb:daed to DNS cache
* Rebuilt URL to: https://myhost.domain.com/
* Hostname myhost.domain.com was found in DNS cache
*   Trying dead:beef:1234:5678:8765:4321:feeb:daed...

curl/libcurl version

curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2g zlib/1.2.11 libidn2/2.0.2 libpsl/0.18.0 (+libidn2/2.0.2) librtmp/2.3
Release-Date: 2017-08-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy PSL

operating system

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:        17.10
Codename:       artful
@bagder
Copy link
Member

bagder commented Nov 16, 2017

An IPv6 address is not generally written with brackets outside of URLs, see RFC 5952 "A Recommendation for IPv6 Address Text Representation". Can you explain why you think you should do it in --resolve ?

I also don't see it mentioned in the documentation.

@demonbane
Copy link
Author

There are three reasons I thought it should be used with brackets in --resolve:

  1. The only example of an IPv6 URL used in the man page lists it as http://[fe80::3%25eth0]/, so it seemed logical that the brackets would be expected and handled properly
  2. The documentation for --resolve shows <host:port:address>. Since an IPv6 address contains the colon (:) character, it seemed logical that including it without some sort of separator character would be incorrect.
  3. When I couldn't get --resolve to work, I tried using --connect-to instead, again with the bracket notation, and it worked just fine:
curl -v --connect-to 'myhost.domain.com:443:[dead:beef:1234:5678:8765:4321:feeb:daed]:443' https://myhost.domain.com
* Rebuilt URL to: https://myhost.domain.com/
* Connecting to hostname: dead:beef:1234:5678:8765:4321:feeb:daed
* Connecting to port: 443
*   Trying dead:beef:1234:5678:8765:4321:feeb:daed...

bagder added a commit that referenced this issue Nov 17, 2017
... so that IPv6 addresses can be passed like they can for connect-to
and how they're used in URLs.

Added test 1324 to verify
Reported-by: Alex Malinovich

Fixes #2087
@bagder
Copy link
Member

bagder commented Nov 17, 2017

You convinced me. Thanks! PR for adding support for brackets is in #2091 !

@bagder
Copy link
Member

bagder commented Nov 17, 2017

Thanks!

@bagder bagder closed this as completed in 715f1f5 Nov 17, 2017
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants