Skip to content

Commit 93a87be

Browse files
committed
HTTPCLIENT-2364: Fixed incorrect re-binding of the upgraded SSL socket to the HTTP connection by the #upgrade method of the DefaultHttpClientConnectionOperator
1 parent a6b3306 commit 93a87be

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public void upgrade(
282282
LOG.debug("{} upgrading to TLS {}:{}", ConnPoolSupport.getId(conn), tlsName.getHostName(), tlsName.getPort());
283283
}
284284
final SSLSocket upgradedSocket = tlsSocketStrategy.upgrade(socket, tlsName.getHostName(), tlsName.getPort(), attachment, context);
285-
conn.bind(upgradedSocket);
285+
conn.bind(upgradedSocket, socket);
286286
onAfterTlsHandshake(context, endpointHost);
287287
if (LOG.isDebugEnabled()) {
288288
LOG.debug("{} upgraded to TLS {}:{}", ConnPoolSupport.getId(conn), tlsName.getHostName(), tlsName.getPort());

httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void testUpgrade() throws Exception {
252252

253253
connectionOperator.upgrade(conn, host, null, Timeout.ofMilliseconds(345), context);
254254

255-
Mockito.verify(conn).bind(upgradedSocket);
255+
Mockito.verify(conn).bind(Mockito.eq(upgradedSocket), Mockito.any());
256256
}
257257

258258
@Test

0 commit comments

Comments
 (0)