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

CURLOPT_PROXY: IPv6 address without port #415

Closed
MarcelRaad opened this Issue Sep 7, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@MarcelRaad
Member

MarcelRaad commented Sep 7, 2015

The following code doesn't work:

curl_easy_setopt(easy_handle, CURLOPT_PROXY, "2a00:fac0:a000::7:13");
curl_easy_setopt(easy_handle, CURLOPT_PROXYPORT, 8080L);

url.c:parse_proxy sets the proxy name to "2a00" and overrides the port with 0, as it tries to parse "fac0:a000::7:13" as a port number. Is this a bug or expected behavior?

Unfortunately the documentation at http://curl.haxx.se/libcurl/c/CURLOPT_PROXY.html doesn't mention if IPv6 addresses have to be in square brackets even if they don't contain a port number or a scheme. If so, probably the documentation should reflect that and parse_proxy should return an error if the port string is invalid.

@bagder bagder self-assigned this Sep 8, 2015

@bagder

This comment has been minimized.

Member

bagder commented Sep 8, 2015

Thanks! I completely agree. I have a fix that makes the parser stricter and adds the bracket requirement to the man page, will push in a second.

@bagder bagder closed this in 87e533a Sep 8, 2015

@MarcelRaad

This comment has been minimized.

Member

MarcelRaad commented Sep 8, 2015

Great, thank you!

jgsogo added a commit to jgsogo/curl that referenced this issue Oct 19, 2015

parse_proxy: reject illegal port numbers
If the port number in the proxy string ended weirdly or the number is
too large, skip it. Mostly as a means to bail out early if a "bare" IPv6
numerical address is used without enclosing brackets.

Also mention the bracket requirement for IPv6 numerical addresses to the
man page for CURLOPT_PROXY.

Closes curl#415

Reported-by: Marcel Raad

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.