[
https://issues.apache.org/jira/browse/HTTPCLIENT-1765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16912149#comment-16912149
]
Jang Ryeol commented on HTTPCLIENT-1765:
----------------------------------------
[~olegk]
OK, I see it's not SSLConnectionSocketFactory problem.
Then why HTTP and HTTPS behave differently regarding connectTimeout of
RequestConfig? Should I open another issue?
{code:java}
@Slf4j
@RunWith(SpringRunner.class)
public class HttpClientTest {
@Test
public void test() {
RequestConfig config = RequestConfig.custom()
.setConnectTimeout(1000).build();
CloseableHttpClient httpclient =
HttpClientBuilder.create().setDefaultRequestConfig(config).build();
/**
* Success
*/
try {
HttpGet httpGet = new HttpGet("http://test1.ryeol.me");
HttpResponse response = httpclient.execute(httpGet);
log.info(IOUtils.toString(response.getEntity().getContent(), "UTF-8"));
} catch (Exception e) {
log.error("Error", e);
}
/**
* ReadTimeout
*/
try {
HttpGet httpGet = new HttpGet("https://test1.ryeol.me");
HttpResponse response = httpclient.execute(httpGet);
log.info(IOUtils.toString(response.getEntity().getContent(), "UTF-8"));
} catch (Exception e) {
log.error("Error", e);
}
}
}
{code}
Regards,
Jang Ryeol
> SSLConnectionSocketFactory uses connectTimeout for read timeout
> ---------------------------------------------------------------
>
> Key: HTTPCLIENT-1765
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1765
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 4.5
> Environment: Any
> Reporter: SATISH BURNWAL
> Priority: Major
> Labels: features
>
> SSLConnectionSocketFactory uses connect timeout value for socket.soTimeout as
> well (as per the code in SSLConnectionsocketFactory). Because of this, when
> clients are created with such config (below), read timeout is not taking
> effect.
> RequestConfig.Builder rb = RequestConfig.custom();
> rb.setConnectTimeout(3000);
> rb.setExpectContinueEnabled(true);
> rb.setSocketTimeout(10000);
> rb.setAuthenticationEnabled(true);
--
This message was sent by Atlassian Jira
(v8.3.2#803003)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]