[
https://issues.apache.org/jira/browse/HTTPCLIENT-2308?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jim Gajnak updated HTTPCLIENT-2308:
-----------------------------------
Attachment: ClassicClientUseCase.java
Description:
Performing a simple HTTPS request using the classic client in 5.2.2 fails with
java.lang.IllegalArgumentException: Invalid Proxy. A simple example is attached
which works correctly using HttpClient 5.2.1, and fails with 5.2.2.
I believe the failure come from
{{org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator}}, in
the {{connect()}} method. Specifically, the line:
{{Socket sock = sf.createSocket(proxy, context);}}
should instead be:
{{Socket sock = (proxy != null) ? sf.createSocket(proxy, context) :
sf.createSocket(context);}}
When I run this example with 5.2.2, I get:
{{Exception in thread "main" 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)
at
org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:142)
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:123)
at
com.example.httpclient.ClassicClientUseCase.main(ClassicClientUseCase.java:16)
}}
was:Performing a simple HTTPS request using the classic client in 5.2.2 fails
with java.lang.IllegalArgumentException: Invalid Proxy. A simple example is
attached which works correctly using HttpClient 5.2.1, and fails with 5.2.2.
Summary: "Invalid Proxy" SSL Connection Failures in 5.2.2 (was:
Non-Proxied SSL Connection Failures in 5.2.2)
> "Invalid Proxy" SSL Connection Failures in 5.2.2
> ------------------------------------------------
>
> Key: HTTPCLIENT-2308
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2308
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 5.2.2
> Reporter: Jim Gajnak
> Priority: Major
> Attachments: ClassicClientUseCase.java
>
>
> Performing a simple HTTPS request using the classic client in 5.2.2 fails
> with java.lang.IllegalArgumentException: Invalid Proxy. A simple example is
> attached which works correctly using HttpClient 5.2.1, and fails with 5.2.2.
> I believe the failure come from
> {{org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator}},
> in the {{connect()}} method. Specifically, the line:
> {{Socket sock = sf.createSocket(proxy, context);}}
> should instead be:
> {{Socket sock = (proxy != null) ? sf.createSocket(proxy, context) :
> sf.createSocket(context);}}
> When I run this example with 5.2.2, I get:
> {{Exception in thread "main" 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)
> at
> org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:142)
> 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:123)
> at
> com.example.httpclient.ClassicClientUseCase.main(ClassicClientUseCase.java:16)
> }}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]