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 2022/11/02 09:05:11 UTC
[httpcomponents-core] branch 5.1.x updated (a8f13137b -> 28d0a9634)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a change to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
discard a8f13137b HTTPCORE-727: Protocol handlers fail to update input metrics when receive input data from a TLS encrypted I/O session
discard 3bc973a9e HTTPCORE-727: Protocol handlers fail to update input metrics when receive input data from a TLS encrypted I/O session
new 28d0a9634 HTTPCORE-727: Protocol handlers fail to update input metrics when receive input data from a TLS encrypted I/O session
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 (a8f13137b)
\
N -- N -- N refs/heads/5.1.x (28d0a9634)
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 1 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:
[httpcomponents-core] 01/01: HTTPCORE-727: Protocol handlers fail to update input metrics when receive input data from a TLS encrypted I/O session
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git
commit 28d0a9634a63f2363b5411e1f2246c2e4e46e632
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Mon Oct 31 21:19:43 2022 +0100
HTTPCORE-727: Protocol handlers fail to update input metrics when receive input data from a TLS encrypted I/O session
---
.../apache/hc/core5/http2/impl/nio/FrameInputBuffer.java | 5 ++++-
.../hc/core5/http2/impl/nio/TestFrameInOutBuffers.java | 16 ++++++++++++++++
.../core5/http/impl/nio/AbstractHttp1StreamDuplexer.java | 2 ++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/FrameInputBuffer.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/FrameInputBuffer.java
index 75414c46e..8de7712a3 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/FrameInputBuffer.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/FrameInputBuffer.java
@@ -111,13 +111,16 @@ public final class FrameInputBuffer {
buffer.clear();
}
final int remaining = buffer.remaining();
- if (remaining >= src.remaining()) {
+ final int n = src.remaining();
+ if (remaining >= n) {
buffer.put(src);
+ metrics.incrementBytesTransferred(n);
} else {
final int limit = src.limit();
src.limit(remaining);
buffer.put(src);
src.limit(limit);
+ metrics.incrementBytesTransferred(remaining);
}
buffer.flip();
}
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
index 2d9cea9e3..b230ed1be 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
@@ -77,6 +77,22 @@ public class TestFrameInOutBuffers {
Assert.assertEquals(1, inBuffer.getMetrics().getFramesTransferred());
Assert.assertEquals(bytes.length, inBuffer.getMetrics().getBytesTransferred());
+
+ final RawFrame frame3 = inBuffer.read(ByteBuffer.wrap(bytes), readableChannel);
+ Assert.assertEquals(FrameType.DATA.getValue(), frame3.getType());
+ Assert.assertEquals(0, frame3.getFlags());
+ Assert.assertEquals(1L, frame3.getStreamId());
+ final ByteBuffer payload3 = frame3.getPayloadContent();
+ Assert.assertNotNull(payload3);
+ Assert.assertEquals(5, payload3.remaining());
+ Assert.assertEquals(1, payload3.get());
+ Assert.assertEquals(2, payload3.get());
+ Assert.assertEquals(3, payload3.get());
+ Assert.assertEquals(4, payload3.get());
+ Assert.assertEquals(5, payload3.get());
+
+ Assert.assertEquals(2, inBuffer.getMetrics().getFramesTransferred());
+ Assert.assertEquals(bytes.length * 2, inBuffer.getMetrics().getBytesTransferred());
}
@Test
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
index b3bb02506..671014985 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
@@ -262,7 +262,9 @@ abstract class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,
public final void onInput(final ByteBuffer src) throws HttpException, IOException {
if (src != null) {
+ final int n = src.remaining();
inbuf.put(src);
+ inTransportMetrics.incrementBytesTransferred(n);
}
if (connState.compareTo(ConnectionState.GRACEFUL_SHUTDOWN) >= 0 && inbuf.hasData() && inputIdle()) {