On Fri, 2018-12-28 at 14:27 +0800, 陈飞 wrote:
> Before handshake during https request, if connectTimeout is set
> alone,
> without socketTimeout, SSLConnectionSocketFactory#connectSocket will
> override socketTimeout with connectTimeout and never change back,
> anyone
> know why? is it a flaw or feature?
> 

What would be your expectation? To have the socket timeout set back to
0? Does this make sense? One can overwrite the default socket timeout
with RequestConfig once the connection has been fully established.

Oleg

> HttpClient version: 4.5.3
> 
> <dependency>
>     <groupId>org.apache.httpcomponents</groupId>
>     <artifactId>httpclient</artifactId>
>     <version>4.5.3</version>
> </dependency>
> 
> Example: ( SocketTimeout of the socket will be 2000ms. )
> 
> public static void main(String[] args) throws IOException {
>     HttpGet httpGet = new HttpGet("https://www.google.com";);
> 
> httpGet.setConfig(RequestConfig.custom().setConnectTimeout(2000).buil
> d());
> 
>     CloseableHttpClient httpclient = HttpClients.createDefault();
>     CloseableHttpResponse response = httpclient.execute(httpGet);
>     try {
>         System.out.println(EntityUtils.toString(response.getEntity())
> );
>     } finally {
>         response.close();
>     }
> }
> 
> Commit history:
> 
https://github.com/apache/httpcomponents-client/commit/d954cd287dfcdad8f153e61181e20d253175ca8c
> Issue before:
> https://issues.apache.org/jira/browse/HTTPCLIENT-1589


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

Reply via email to