You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Marcelo Cenerino (JIRA)" <ji...@apache.org> on 2018/08/11 19:07:00 UTC

[jira] [Closed] (HTTPCLIENT-1940) org.apache.http.conn.ssl.SSLSocketFactory no longer throws ConnectTimeoutException

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

Marcelo Cenerino closed HTTPCLIENT-1940.
----------------------------------------

> org.apache.http.conn.ssl.SSLSocketFactory no longer throws ConnectTimeoutException
> ----------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1940
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1940
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 4.5.3
>            Reporter: Marcelo Cenerino
>            Priority: Major
>             Fix For: 4.5.7, 4.6 Alpha1
>
>         Attachments: ConnectExceptionTest.java
>
>
> We are upgrading httpclient from 4.2.3 to 4.5.3. We wanted to do the upgrade in steps: first we just bump the versions and then we gradually refactor the existing code to use the new builder-based api.
> It turns out that there is a behavior change in "org.apache.http.conn.ssl.SSLSocketFactory" (which is deprecated in 4.3+): in case of a connect timeout, it does not translate the exception to ConnectTimeoutException. This is inconsistent with the also deprecated "org.apache.http.conn.scheme.PlainSocketFactory". In the 4.2.x series, the exception used to be converted. These are likely the commits that introduced the issue:
>  * Exception translation moved to an abstract class: [https://github.com/apache/httpcomponents-client/commit/e34e868ddc96b873a09b20e4911bc64fe8caf069#diff-2b61663f90e19b0024cea23ce9e5e791]
>  * Abstract class removed without moving the exception translation code back to SSLSocketFactory: [https://github.com/apache/httpcomponents-client/commit/d04b7baa642e7192bddb8e0ad26c7504c6908c85#diff-2b61663f90e19b0024cea23ce9e5e791]
>  
> I attached a test that reproduces the bug: [^ConnectExceptionTest.java]
> This bug is not reproducible with the new builder api. However, given that the old api was kept to maintain backwards compatibility, I think it is reasonable to expect the old behavior.
> As workarounds to this issue, one can either update the code and use the new api or catch the java.net.SocketTimeoutException and check if the message is "connect timed out".
> Given that the bug hides in deprecated code and there are workarounds, maybe it is not worth fixing it. In that case, please feel free to close this ticket. Otherwise, I can submit a patch.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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