b/2599994 Should call prepareSocket on underlying socket, not layered socket
DefaultClientConnectionOperator.openConnection was recently changed to
use LayeredSocketFactory.createSocket(Socket, ...) to create an
SSLSocket around a plain java.net.Socket. However, this means code in
LayeredSocketFactory.createSocket(Socket, ...) is called before socket
options such as timeout are set by
DefaultClientConnectionOperator.prepareSocket. However, the default
org.apache.http.conn.ssl.SSLSocketFactory.createSocket(Socket, ...)
performes the SSL handshake to perform hostname verification, meaning
the handshake is performed without timeouts set.
This change to DefaultClientConnectionOperator.openConnection moves
the call prepareSocket to be on the underlying java.net.Socket before
it is has the SSLSocket layered on top of it to prevent hangs during
SSL handshakes.
Change-Id: If705cc1acfe524281ec1338f73eccf7c0f4d1227
1 file changed