Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
2.7.6, 2.7.7, 2.7.8, 2.7.9, 2.7.10, 2.7.11
-
Windows or Linux
-
Novice
Description
This issue occurs when using the asynchronous conduit (use.async.http.conduit set to true), AND with the environment proxy configuration set (http.proxyHost, http.proxyPort, and http.nonProxyHosts properties set).
The end of the AsyncHTTPConduit.setupConnection() method calls:
<code>
Proxy p = proxyFactory.createProxy(csPolicy , uri);
if (p != null) {
</code>
When the http.nonProxyHosts property matches the target server host, then the ProxyFactory.createProxy() method returns Proxy.NO_PROXY, and not null. This means that because p is not null, the next 2 lines are executed:
<code>
InetSocketAddress isa = (InetSocketAddress)p.address();
HttpHost proxy = new HttpHost(isa.getHostName(), isa.getPort());
</code>
p.address() returns null as expected, which means that the next line (line 200 in release 2.7.6) causes a NullPointerException, and crashes the call.
The fix would be simple, by replacing:
<code>
if (p != null) {
</code>
with
<code>
if (p != null && !p.type() == Proxy.Type.DIRECT) {
</code>