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

HTTP Client: Disable Name Resolution in Proxy Mode #522

Open
alexanderkiel opened this issue Sep 5, 2019 · 4 comments
Open

HTTP Client: Disable Name Resolution in Proxy Mode #522

alexanderkiel opened this issue Sep 5, 2019 · 4 comments

Comments

@alexanderkiel
Copy link

alexanderkiel commented Sep 5, 2019

When going though a proxy, local name resolution isn't necessary, because the full URL is send to the proxy.

If I set only :proxy-options in :connection-options while creating a connection-pool, Netty is still resolving the remote address without any need.

Setting, in addition to :proxy-options, :name-resolver to :noop, solves the problem.

It might be a good idea to do this by default. But I may also overlook something here.

@dspearson
Copy link
Contributor

Just to add my 2c: I use name resolution in proxy mode, specifically with Tor (DNSPort, AutomapHostsOnResolve, HTTPTunnelPort). However, this is with an explicit :name-resolver, and using :tunnel? true.

@kachayev
Copy link
Collaborator

Good point. From what I can see, curl by default disables name resolution for non-tunnel proxy but resolves host when sending CONNECT (--proxytunnel setting). I think, it makes sense to follow the same logic: if no configuration is given for DNS resolver and the client establishes non-tunnel connection, the resolver should be set to :noop. Explicitly setting to :default should force client to resolve name first.

@kachayev
Copy link
Collaborator

kachayev commented Aug 23, 2020

@alexanderkiel I'm trying to reproduce the situation and... I don't see the host being resolved, both with tunnel and non-tunnel options (see attached Wireshark screenshots). No configuration to name-resolver is provided. Do you have short reproducer that I can run to see what's going on wrong?
Screen Shot 2020-08-22 at 8 23 24 PM
Screen Shot 2020-08-22 at 8 23 34 PM

@kachayev kachayev added the waiting on user Waiting for more information from the user label Aug 23, 2020
@kachayev
Copy link
Collaborator

Oh... okay, it seems I finally got the problem. We do send DNS query even thought we don't use the result. So, better not to waste time by default. But there's another question, if proxy host is given as domain name rather than IP, it itself should be resolve before establishing the connection. I'm not sure if setting DNS resolver to :noop is the best call here. We should probably create URI as "resolved" to avoid whatever DNS resolver configured skips resolution for destination but still be able to resolve proxy. Let me think what would be a good way to accomplish this.

@kachayev kachayev added operational improvements 1.0 and removed waiting on user Waiting for more information from the user labels Aug 23, 2020
@arnaudgeiser arnaudgeiser removed the 1.0 label Nov 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants