mmoayyed opened a new pull request, #512:
URL: https://github.com/apache/httpcomponents-client/pull/512

   This seems to have caused a regression in 5.2.2.
   
    
   
   java.lang.IllegalArgumentException: Invalid Proxy
       at java.base/java.net.Socket.<init>(Socket.java:216)
       at 
org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory.createSocket(SSLConnectionSocketFactory.java:208)
       at 
org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
       at 
org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:447)
       at 
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:162)
       at 
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:172)
 
   When the proxy is undefined or set to null, 
DefaultHttpClientConnectionOperator does the following:
   
    
   
   Timeout soTimeout = socketConfig.getSoTimeout();
   SocketAddress socksProxyAddress = socketConfig.getSocksProxyAddress();
   Proxy proxy = socksProxyAddress != null ? new Proxy(Type.SOCKS, 
socksProxyAddress) : null; 
   The proxy object above is then null, which means the following call:
   
   Socket sock = sf.createSocket(proxy, context); 
   ...will eventually pass down to SSLConnectionSocketFactory which does this:
   
   public Socket createSocket(Proxy proxy, HttpContext context) throws 
IOException {
       return new Socket(proxy); //this proxy cannot be null
   } 
    
   I think the code needs to do something like this:
   
   if (proxy != null) {
         Socket sock = sf.createSocket(proxy, context);  
   } else {
         Socket sock = sf.createSocket(context); 
   }
    
   
   I should mention that in the above case,
   
   No SOCKS proxy is ever configured via the 
PoolingHttpClientConnectionManagerBuilder. setDefaultSocketConfig() method 
   No  SocketConfig.setSocksProxyAddress(socksaddr) exists and is always null.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to