You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "mmoayyed (via GitHub)" <gi...@apache.org> on 2023/11/26 20:38:02 UTC

[PR] HTTPCLIENT-2292: fix regression leading to invalid proxy [httpcomponents-client]

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-unsubscribe@hc.apache.org

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


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


Re: [PR] HTTPCLIENT-2292: fix regression leading to invalid proxy [httpcomponents-client]

Posted by "mmoayyed (via GitHub)" <gi...@apache.org>.
mmoayyed commented on PR #512:
URL: https://github.com/apache/httpcomponents-client/pull/512#issuecomment-1827360027

   Thank you!


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] HTTPCLIENT-2292: fix regression leading to invalid proxy [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #512:
URL: https://github.com/apache/httpcomponents-client/pull/512#issuecomment-1826907149

   Fixed by 6d60624cd3439f81030f7443e72cba21662e5d7b


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] HTTPCLIENT-2292: fix regression leading to invalid proxy [httpcomponents-client]

Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c closed pull request #512: HTTPCLIENT-2292: fix regression leading to invalid proxy
URL: https://github.com/apache/httpcomponents-client/pull/512


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] HTTPCLIENT-2292: fix regression leading to invalid proxy [httpcomponents-client]

Posted by "Sineaggi (via GitHub)" <gi...@apache.org>.
Sineaggi commented on PR #512:
URL: https://github.com/apache/httpcomponents-client/pull/512#issuecomment-1885652488

   Unfortunately this is still causing issues for projects such as docker-java (see https://github.com/docker-java/docker-java/issues/2290). Currently this bug manifests as a backwards-imcompatible change to projects inheriting from PlainConnectionSocketFactory and SSLConnectionSocketFactory.
   
   I've made an example fix https://github.com/apache/httpcomponents-client/pull/535 to pull the proxy null check higher out


-- 
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-unsubscribe@hc.apache.org

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


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


Re: [PR] HTTPCLIENT-2292: fix regression leading to invalid proxy [httpcomponents-client]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #512:
URL: https://github.com/apache/httpcomponents-client/pull/512#issuecomment-1828011894

   FWIW, I ran into the same regression. Staying on 5.2.1 for now...


-- 
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-unsubscribe@hc.apache.org

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


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