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

CURLOPT_RESOLVE ignored when a proxy is set #2346

Closed
lessandro opened this issue Mar 1, 2018 · 2 comments
Closed

CURLOPT_RESOLVE ignored when a proxy is set #2346

lessandro opened this issue Mar 1, 2018 · 2 comments
Labels

Comments

@lessandro
Copy link

lessandro commented Mar 1, 2018

Setting up a proxy will cause CURLOPT_RESOLVE to be ignored.

This is especially problematic if you are relying on CURLOPT_RESOLVE to provide a host name for SNI or common name validation for a server without a reachable domain name.

For example, I want to connect to a server at https://192.168.1.100 and expect the common name "abcdef123456". This works fine with CURLOPT_RESOLVE -- adding abcdef123456:443:192.168.1.100 to the resolve list, and connecting to https://abcdef123456/, however when a proxy is set, curl sends a CONNECT abcdef123456:443 to the proxy, which will not work.

CURL: Added abcdef123456:443:192.168.1.100 to DNS cache
CURL: Hostname 192.168.1.200 was found in DNS cache
CURL:   Trying 192.168.1.200...
CURL: TCP_NODELAY set
CURL: Connected to 192.168.1.200 (192.168.1.200) port 10000 (#6)
CURL: allocate connect buffer!
CURL: Establish HTTP proxy tunnel to abcdef123456:443
CURL > CONNECT abcdef123456:443 HTTP/1.1
Host: abcdef123456:443
Proxy-Connection: Keep-Alive

CURL < HTTP/1.1 502 Fiddler - DNS Lookup Failed

I expect curl to send a CONNECT 192.168.1.100:443 to the proxy instead.

@bagder
Copy link
Member

bagder commented Mar 1, 2018

I can understand what you wanted to happen here, but when curl uses a HTTP proxy it doesn't try to resolve any name (that would even risk leaking that information to local servers) but will send the name as-is to the proxy. CURLOPT_RESOLVE shortcuts name resolving, but since it isn't done for HTTP proxies it has no effect when that's used. Thus, this is actually working as intended!

@bagder bagder added the not-a-curl-bug This is not a bug in curl label Apr 29, 2018
@bagder
Copy link
Member

bagder commented Apr 29, 2018

This seems to not be a bug.

@bagder bagder closed this as completed Apr 29, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants