Pass HttpContext to SSLConnectionSocketFactory#prepareSocket method (#404)
This commit is contained in:
parent
3403571c18
commit
4695041df4
|
@ -178,6 +178,13 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
|||
this.tlsSessionValidator = new TlsSessionValidator(LOG);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #prepareSocket(SSLSocket, HttpContext)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected void prepareSocket(final SSLSocket socket) throws IOException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs any custom initialization for a newly created SSLSocket
|
||||
* (before the SSL handshake happens).
|
||||
|
@ -186,7 +193,9 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
|||
* call {@link javax.net.ssl.SSLSocket#setEnabledCipherSuites(String[])}.
|
||||
* @throws IOException may be thrown if overridden
|
||||
*/
|
||||
protected void prepareSocket(final SSLSocket socket) throws IOException {
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void prepareSocket(final SSLSocket socket, final HttpContext context) throws IOException {
|
||||
prepareSocket(socket);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -245,7 +254,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
|||
// Setup SSL layering if necessary
|
||||
if (sock instanceof SSLSocket) {
|
||||
final SSLSocket sslsock = (SSLSocket) sock;
|
||||
executeHandshake(sslsock, host.getHostName(), attachment);
|
||||
executeHandshake(sslsock, host.getHostName(), attachment, context);
|
||||
return sock;
|
||||
}
|
||||
return createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), attachment, context);
|
||||
|
@ -272,11 +281,15 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
|||
target,
|
||||
port,
|
||||
true);
|
||||
executeHandshake(sslsock, target, attachment);
|
||||
executeHandshake(sslsock, target, attachment, context);
|
||||
return sslsock;
|
||||
}
|
||||
|
||||
private void executeHandshake(final SSLSocket sslsock, final String target, final Object attachment) throws IOException {
|
||||
private void executeHandshake(
|
||||
final SSLSocket sslsock,
|
||||
final String target,
|
||||
final Object attachment,
|
||||
final HttpContext context) throws IOException {
|
||||
final TlsConfig tlsConfig = attachment instanceof TlsConfig ? (TlsConfig) attachment : TlsConfig.DEFAULT;
|
||||
if (supportedProtocols != null) {
|
||||
sslsock.setEnabledProtocols(supportedProtocols);
|
||||
|
@ -293,7 +306,7 @@ public class SSLConnectionSocketFactory implements LayeredConnectionSocketFactor
|
|||
sslsock.setSoTimeout(handshakeTimeout.toMillisecondsIntBound());
|
||||
}
|
||||
|
||||
prepareSocket(sslsock);
|
||||
prepareSocket(sslsock, context);
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Enabled protocols: {}", (Object) sslsock.getEnabledProtocols());
|
||||
|
|
Loading…
Reference in New Issue