[
https://issues.apache.org/jira/browse/HTTPCLIENT-2090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17142561#comment-17142561
]
Dave Moten commented on HTTPCLIENT-2090:
----------------------------------------
Yep different code paths for a connection through a proxy. The difference boils
down to this interface:
{{
public interface HttpClientConnectionOperator {
void connect(
ManagedHttpClientConnection conn,
HttpHost host,
InetSocketAddress localAddress,
int connectTimeout,
SocketConfig socketConfig,
HttpContext context) throws IOException;
void upgrade(
ManagedHttpClientConnection conn,
HttpHost host,
HttpContext context) throws IOException;
}
}}
The non-proxy connection goes through the `connect` method above and a timeout
is passed that is ostensibly for connecting but is also used as a read timeout
in the SSL handshake.
The proxy connection goes through the `upgrade` method above and no timeout is
passed in a method parameter at that point making application of defaults (like
used in non-proxy `connect` method) difficult (except by configuring
SocketConfig which presumably affects some factory somewhere).
I think bug is not a correct description and I'd describe my issue as a feature
request. I'd like the proxy connection to have some reasonable default for
socket timeout (read) because a default behaviour of wait forever is not going
to make anybody happy, especially as an SSL Handshake should normally be a very
short-lived affair. I'd like to see the code actively set the soTimeout to some
reasonable default value for the SSL handshake if it has not been specified by
SocketConfig. Is this a reasonable request Oleg? Would you like me to close
this issue and open another with the feature request?
> Read timeout not applied for SSLHandshake when using proxy
> ----------------------------------------------------------
>
> Key: HTTPCLIENT-2090
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2090
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 4.5.12
> Reporter: Dave Moten
> Priority: Minor
>
> When I make a connection to an https endpoint without proxy I've confirmed
> that read timeouts as specified in the RequestConfig part of the client are
> applied by putting a breakpoint against the startHandshake line in
> SSLConnectionSocketFactory:394 (I viewed the expression
> sslsock.getSoTimeout()).
> However, when I make a connection to an https endpoint (e.g.
> https://google.com) via our corporate proxy I can see via the same breakpoint
> that sslsock.getSoTimeout() returns 0.
> Here's the test code that when debugged showed the problem:
> {{RequestConfig requestConfig = RequestConfig
> .custom()
> .setConnectionRequestTimeout(10000)
> .setConnectTimeout(10000)
> .setSocketTimeout(5000)
> .build();
> HttpClient client = HttpClientBuilder
> .create()
> .setDefaultRequestConfig(requestConfig)
> .setProxy(HttpHost.create("http://proxy:8080")) //
> .build();
> HttpGet get = new HttpGet("https://google.com");
> client.execute(get);}}
> By the way the consequence of this has been hangs in our production
> environment talking to Microsoft's EWS service which seemed to be flaky last
> week.
> I have a workaround described by Li Changshu in HTTPCLIENT-1478 involving
> setting a pooling connection manager but I would like the library to behave
> consistently when using a proxy.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]