You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2024/06/22 15:24:28 UTC
(httpcomponents-client) branch master updated (31f1812e1 -> a2ad22541)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
discard 31f1812e1 HTTPCLIENT-2328: Blocking i/o connections to check if the opposite TLS endpoint has been closed by the opposite endpoint while writing out request body
new ee0a10210 HTTPCLIENT-2328: Blocking i/o connections to check if the opposite TLS endpoint has been closed by the opposite endpoint while writing out request body
new a2ad22541 Updated release notes for HttpClient 5.4-beta1 release
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (31f1812e1)
\
N -- N -- N refs/heads/master (a2ad22541)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
RELEASE_NOTES.txt | 49 +++++++++++++++++++---
.../http/ssl/AbstractClientTlsStrategy.java | 10 ++++-
2 files changed, 51 insertions(+), 8 deletions(-)
(httpcomponents-client) 01/02: HTTPCLIENT-2328: Blocking i/o connections to check if the opposite TLS endpoint has been closed by the opposite endpoint while writing out request body
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit ee0a102104d03a8d1cfe18e571d179c41242182c
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Jun 22 17:13:27 2024 +0200
HTTPCLIENT-2328: Blocking i/o connections to check if the opposite TLS endpoint has been closed by the opposite endpoint while writing out request body
---
.../impl/io/DefaultHttpClientConnectionOperator.java | 4 ++--
.../http/impl/io/DefaultManagedHttpClientConnection.java | 8 ++++++++
.../hc/client5/http/impl/io/LoggingSocketHolder.java | 7 +++++++
.../hc/client5/http/io/ManagedHttpClientConnection.java | 16 ++++++++++++++++
.../hc/client5/http/ssl/AbstractClientTlsStrategy.java | 12 +++++++++---
.../http/impl/io/TestHttpClientConnectionOperator.java | 2 +-
6 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
index 8212c83f8..a90847cb8 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultHttpClientConnectionOperator.java
@@ -235,8 +235,8 @@ public class DefaultHttpClientConnectionOperator implements HttpClientConnection
if (LOG.isDebugEnabled()) {
LOG.debug("{} {} upgrading to TLS", ConnPoolSupport.getId(conn), tlsName);
}
- final Socket upgradedSocket = tlsSocketStrategy.upgrade(socket, tlsName.getHostName(), tlsName.getPort(), attachment, context);
- conn.bind(upgradedSocket);
+ final SSLSocket sslSocket = tlsSocketStrategy.upgrade(socket, tlsName.getHostName(), tlsName.getPort(), attachment, context);
+ conn.bind(sslSocket, socket);
onAfterTlsHandshake(context, endpointHost);
if (LOG.isDebugEnabled()) {
LOG.debug("{} {} upgraded to TLS", ConnPoolSupport.getId(conn), tlsName);
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
index 03d697dcd..720d614e3 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/DefaultManagedHttpClientConnection.java
@@ -184,6 +184,14 @@ final class DefaultManagedHttpClientConnection
socketTimeout = Timeout.ofMilliseconds(socket.getSoTimeout());
}
+ @Override
+ public void bind(final SSLSocket sslSocket, final Socket socket) throws IOException {
+ super.bind(WIRE_LOG.isDebugEnabled() ?
+ new LoggingSocketHolder(sslSocket, socket, this.id, WIRE_LOG) :
+ new SocketHolder(sslSocket, socket));
+ socketTimeout = Timeout.ofMilliseconds(sslSocket.getSoTimeout());
+ }
+
@Override
protected void onResponseReceived(final ClassicHttpResponse response) {
if (response != null && HEADER_LOG.isDebugEnabled()) {
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LoggingSocketHolder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LoggingSocketHolder.java
index 5107b3316..a042849e9 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LoggingSocketHolder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/io/LoggingSocketHolder.java
@@ -32,6 +32,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
+import javax.net.ssl.SSLSocket;
+
import org.apache.hc.client5.http.impl.Wire;
import org.apache.hc.core5.http.impl.io.SocketHolder;
import org.slf4j.Logger;
@@ -45,6 +47,11 @@ class LoggingSocketHolder extends SocketHolder {
this.wire = new Wire(log, id);
}
+ LoggingSocketHolder(final SSLSocket sslSocket, final Socket baseSocket, final String id, final Logger log) {
+ super(sslSocket, baseSocket);
+ this.wire = new Wire(log, id);
+ }
+
@Override
protected InputStream getInputStream(final Socket socket) throws IOException {
return new LoggingInputStream(super.getInputStream(socket), wire);
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/io/ManagedHttpClientConnection.java b/httpclient5/src/main/java/org/apache/hc/client5/http/io/ManagedHttpClientConnection.java
index 48546b963..0877c92df 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/io/ManagedHttpClientConnection.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/io/ManagedHttpClientConnection.java
@@ -31,6 +31,7 @@ import java.io.IOException;
import java.net.Socket;
import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocket;
import org.apache.hc.core5.annotation.Internal;
import org.apache.hc.core5.http.io.HttpClientConnection;
@@ -55,6 +56,21 @@ public interface ManagedHttpClientConnection extends HttpClientConnection {
*/
void bind(Socket socket) throws IOException;
+ /**
+ * Binds this connection to the SSL given socket and the underlying network
+ * socket. The connection is considered open if it is bound, the underlying
+ * network socket is connection to a remote host and the SSL socket is
+ * fully initialized (TLS handshake has been successfully executed).
+ *
+ * @param sslSocket the SSL socket to bind the connection to.
+ * @param socket the underlying network socket of the SSL socket.
+ *
+ * @since 5.4
+ */
+ default void bind(SSLSocket sslSocket, Socket socket) throws IOException {
+ bind(sslSocket);
+ }
+
/**
* Returns the underlying socket.
*/
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
index ff236f21f..c79d8394d 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java
@@ -62,6 +62,7 @@ import org.apache.hc.core5.http.ssl.TlsCiphers;
import org.apache.hc.core5.http2.HttpVersionPolicy;
import org.apache.hc.core5.http2.ssl.ApplicationProtocol;
import org.apache.hc.core5.http2.ssl.H2TlsSupport;
+import org.apache.hc.core5.io.Closer;
import org.apache.hc.core5.net.NamedEndpoint;
import org.apache.hc.core5.reactor.ssl.SSLBufferMode;
import org.apache.hc.core5.reactor.ssl.TlsDetails;
@@ -204,9 +205,14 @@ abstract class AbstractClientTlsStrategy implements TlsStrategy, TlsSocketStrate
socket,
target,
port,
- true);
- executeHandshake(upgradedSocket, target, attachment);
- return upgradedSocket;
+ false);
+ try {
+ executeHandshake(upgradedSocket, target, attachment);
+ return upgradedSocket;
+ } catch (IOException | RuntimeException ex) {
+ Closer.closeQuietly(upgradedSocket);
+ throw ex;
+ }
}
private void executeHandshake(
diff --git a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
index 64aff2612..e369f495a 100644
--- a/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
+++ b/httpclient5/src/test/java/org/apache/hc/client5/http/impl/io/TestHttpClientConnectionOperator.java
@@ -147,7 +147,7 @@ public class TestHttpClientConnectionOperator {
Mockito.verify(socket).connect(new InetSocketAddress(ip1, 443), 123);
Mockito.verify(conn, Mockito.times(2)).bind(socket);
Mockito.verify(tlsSocketStrategy).upgrade(socket, "somehost", -1, tlsConfig, context);
- Mockito.verify(conn, Mockito.times(1)).bind(upgradedSocket);
+ Mockito.verify(conn, Mockito.times(1)).bind(upgradedSocket, socket);
}
@Test
(httpcomponents-client) 02/02: Updated release notes for HttpClient 5.4-beta1 release
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit a2ad225419b9406719b53ce749dac55ae774e861
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Jun 22 17:21:37 2024 +0200
Updated release notes for HttpClient 5.4-beta1 release
---
RELEASE_NOTES.txt | 49 +++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 6 deletions(-)
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 758ee005f..cb9e9407b 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,11 +1,8 @@
-Release 5.4 ALPHA2
+Release 5.4 BETA1
------------------
-This is the second and likely the last ALPHA release in the 5.3 release series.
-It finalizes the new Cache API introduced in the previous ALPHA release and also
-improves TLS customization for the classic transport, SNI and endpoint identification
-support, authentication data caching, and HTTP context performance. It also introduces
-support for optional TLS upgrades for HTTP/1.1 connections.
+This is the first BETA release in the 5.4 release series. It upgrades HttpCore to version
+5.3-beta1 and adds a number of minor improvements and fixes.
IMPORTANT! Please note the new cache entry serialization format is incompatible with earlier
versions of HttpClient Cache. Persistent caches (file system based, Memcached, EhCAche
@@ -40,6 +37,46 @@ Notable changes and features included in the 5.4 series:
* HttpContext optimization and performance improvement.
+
+Change Log
+-------------------
+
+* HTTPCLIENT-2328: Blocking i/o connections to check if the opposite TLS endpoint
+ has been closed by the opposite endpoint while writing out request body.
+ Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* Redesign of test server APIs and integration test setup
+ Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* HTTPCLIENT-2331: Skip cookie header generation if a Cookie header is already
+ present (#561).
+ Contributed by Arturo Bernal <abernal at apache.org>
+
+* HTTPCLIENT-2326: Propagate original proxy response to the caller in case of
+ HTTP CONNECT request failure.
+ Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* HTTPCLIENT-2327: Propagate CancellationExceptions from MemcachedClient operations
+ as ResourceIOExceptions (#559).
+ Contributed by jattisha <jattisha at umich.edu>
+
+* Callbacks for Connection initialization.
+ Contributed by Richard Tippl <richard.tippl at gmail.com>
+
+* HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests
+ Contributed by Vladimir Sitnikov <sitnikov.vladimir at gmail.com>
+
+
+
+Release 5.4 ALPHA2
+------------------
+
+This is the second and likely the last ALPHA release in the 5.3 release series.
+It finalizes the new Cache API introduced in the previous ALPHA release and also
+improves TLS customization for the classic transport, SNI and endpoint identification
+support, authentication data caching, and HTTP context performance. It also introduces
+support for optional TLS upgrades for HTTP/1.1 connections.
+
Change Log
-------------------