-
Notifications
You must be signed in to change notification settings - Fork 974
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
HTTPCLIENT-2350 - Enhance HttpClientConnectionOperator with Optional DNS Resolution Control #598
Conversation
@arturobernalg Damn. I also started working on this one. Conceptually I am not in favor of adding a new config nob every time someone asks for it. We did that often in the days of HC 3 and did us little good. I would prefer this issue solved with a custom |
@@ -153,43 +153,50 @@ public void connect( | |||
final Timeout connectTimeout, | |||
final SocketConfig socketConfig, | |||
final Object attachment, | |||
final HttpContext context) throws IOException { | |||
final HttpContext context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be a lot more flexible if this could be configured through the context (that's what we did to this forked class).
|
||
if (disableDnsResolution) { | ||
// Hostname is an .onion address. Do not try to resolve it to an InetAddress. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or not, it's not determining what the address is.
I'd much be in favour of something like that. |
c261404
to
a9da185
Compare
Fair enough, @ok2c . I agree with your point about avoiding adding new configuration knobs unnecessarily. I've updated the implementation to use a Function. Please take another pass |
@arturobernalg My idea was to add this method to
|
What about now, @ok2c ? I believe I've made the correct changes this time. Please review. |
60720f9
to
71bf32b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg Looks good to me, but similar change needs to be doe to MultihomeIOSessionRequester
as well.
Mockito.eq(null), | ||
Mockito.any(), | ||
Mockito.eq(null))) | ||
Mockito.eq(route), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg Can we avoid formatting changes in the same commit with functional ones? If you want to change formatting please do it through the style check or at least in a separate commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pelase @ok2c do another pass.
84d0099
to
7b678ce
Compare
* | ||
* @since 5.5 | ||
*/ | ||
default List<SocketAddress> resolve(String host, int port) throws UnknownHostException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg Almost there. Let's change this method to return List<InetSocketAddress>
in order to avoid ugly downcasts in several places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
dee610f
to
17395ad
Compare
@@ -129,7 +129,7 @@ public void cancelled() { | |||
|
|||
void executeNext() { | |||
final int index = attempt.getAndIncrement(); | |||
final InetSocketAddress remoteAddress = new InetSocketAddress(remoteAddresses[index], remoteEndpoint.getPort()); | |||
final InetSocketAddress remoteAddress = (InetSocketAddress) remoteAddresses.get(index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arturobernalg I suppose this cast is no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ok2c I don't know what happened. I just removed.
…onnectionOperator to enhance flexibility in address resolution, specifically allowing for direct handling of unresolved addresses. Updated DnsResolver to introduce a new resolve method supporting both standard and bypassed DNS lookups, enabling improved support for non-public resolvable hosts like .onion endpoints via SOCKS proxy. Adjusted related tests to align with the new resolution mechanism.
f7dcfae
to
9ae18e2
Compare
This PR introduces an enhancement to
DefaultHttpClientConnectionOperator
, adding the ability to disable DNS resolution for specific connections. This is particularly useful when connecting to .onion addresses through a SOCKS proxy, where public DNS lookups are not possible or desirable.