Re: Host name resolution
There are lots of reasons, and unfortunatelly they have different ways to detect. Here are a few: - proxy setting (if a system or application proxy is set it might resolve addresses differently in one or the other) - ipv6 preference: when the host has v4 and v6 addresses the prio in java prefers either all v4 or all v6 whereas system or browsers might use different - java resolution cache: if no security manager then java caches for 10s otherwise indefinitely, browser might refresh faster - different dns servers: java should use the system resolver but app might have its own dns setting (unlikely: you reconfigured java to not use system resolver) - Browsers try to implement a good user experience, this includes trying resolving and connection in parallel/asny which leads to different timing - dns based load balancer or site preference (windows ad!) Looking at the source ip of query I would start checking the system for stale/slow resolvers, checking the target hostname for multiple (stale) addresses and go from there. It certainly helps if you can actually log the ips used and ips expected. Gruss Bernd -- http://bernd.eckenfels.net -Original Message- From: "Mark A. Claassen" <mclaas...@ocie.net> To: HttpClient User Discussion <httpclient-users@hc.apache.org> Sent: Mi., 18 Mai 2016 16:47 Subject: Host name resolution Every once in a while, it seems that my apache HTTP client seems to resolve a host name different that when I use the command line. We had done some infrastructure work (months ago) and some of our internal domain names had changed. Now, everything will work fine, until all of a sudden it will just stop. These are caused by DNS resolution problems. It is possible that some DNS server here has some old data or something. However, my question is about why HttpClient seems to not use the same resolution method as my browser, or the command line. Why is that? Is there a way to tell what is going on? Thanks, Mark Disclaimer: The opinions provided herein do not necessarily state or reflect those of Donnell Systems, Inc.(DSI). DSI makes no warranty for and assumes no legal liability or responsibility for the posting. - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org
Host name resolution
Every once in a while, it seems that my apache HTTP client seems to resolve a host name different that when I use the command line. We had done some infrastructure work (months ago) and some of our internal domain names had changed. Now, everything will work fine, until all of a sudden it will just stop. These are caused by DNS resolution problems. It is possible that some DNS server here has some old data or something. However, my question is about why HttpClient seems to not use the same resolution method as my browser, or the command line. Why is that? Is there a way to tell what is going on? Thanks, Mark Disclaimer: The opinions provided herein do not necessarily state or reflect those of Donnell Systems, Inc.(DSI). DSI makes no warranty for and assumes no legal liability or responsibility for the posting. - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org
Re: What is the preferred way to override host name resolution in HC 4.1?
On 14 October 2011 18:58, Matt Solnit msol...@soasta.com wrote: Hi everyone. In HC 4.0, the way that a host name is converted to an InetAddress object could be overridden by passing a custom HostNameResolver implementation to the socket factory. It looks like in HC 4.1, this is deprecated. What is the preferred way of customizing host name resolution? I took a look at the source code, and I am guessing I will need to override DefaultClientConnectionOperator.resolveHostName(). But I want to be sure this is the best way. For HC 4.1 I would say the same, this looks the only way to do it. Will be hard to use your implementation because you must extend also SingleClientConnManager in order to inject it. In HC 4.2 this will be much simpler, but this version is not GA yet. -- Matt - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org
Re: What is the preferred way to override host name resolution in HC 4.1?
Alternatively you can inspire from the code available in 4.2: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/conn/DnsResolver.java http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SystemDefaultDnsResolver.java http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/InMemoryDnsResolver.java http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnectionOperator.java On 14 October 2011 20:43, Vasile Alin alinachegal...@gmail.com wrote: On 14 October 2011 18:58, Matt Solnit msol...@soasta.com wrote: Hi everyone. In HC 4.0, the way that a host name is converted to an InetAddress object could be overridden by passing a custom HostNameResolver implementation to the socket factory. It looks like in HC 4.1, this is deprecated. What is the preferred way of customizing host name resolution? I took a look at the source code, and I am guessing I will need to override DefaultClientConnectionOperator.resolveHostName(). But I want to be sure this is the best way. For HC 4.1 I would say the same, this looks the only way to do it. Will be hard to use your implementation because you must extend also SingleClientConnManager in order to inject it. In HC 4.2 this will be much simpler, but this version is not GA yet. -- Matt - To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org