[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marcin DÄ…browski reopened HTTPCLIENT-2309:
------------------------------------------

Please also check the code in the fix: 
[https://github.com/apache/httpcomponents-client/pull/507/files]

This the code from Java:

{code:java}
    public Socket(Proxy proxy) {
        // Create a copy of Proxy as a security measure
        if (proxy == null) {
            throw new IllegalArgumentException("Invalid Proxy");
        }
{code}

so Invalid Proxy is returned when proxy is null.
The fix that was applied looks like this:

{code:java}
    public Socket createSocket(final Proxy proxy, final HttpContext context) 
throws IOException {
        return proxy != null ? new Socket(proxy) : new Socket();
    }
{code}

So the fix is for null. In my case I set proxy as not null in the builder 
instance, but later in the runtime it is null.


> Proxy url set via HttpClientBuilder is not working
> --------------------------------------------------
>
>                 Key: HTTPCLIENT-2309
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2309
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 5.2.2
>            Reporter: Marcin DÄ…browski
>            Priority: Major
>
> I'm using {{org.apache.hc.client5.http.impl.classic.HttpClientBuilder}} and 
> setting proxy via {{builder.setProxy(HttpHost.create(myProxyUri))}}. 
> After upgrade from 5.2.1 to 5.2.2 I'm getting:
> {noformat}
> Caused by: java.lang.IllegalArgumentException: Invalid Proxy
>       at java.base/java.net.Socket.<init>(Socket.java:177)
>       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)
>       at 
> org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:146)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:96)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:115)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
>       at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:87)
>       at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:55)
>       at 
> org.apache.hc.client5.http.classic.HttpClient.executeOpen(HttpClient.java:183)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to