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/10/31 20:20:28 UTC

[httpcomponents-core] branch HTTPCORE-727 created (now 3bc973a9e)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch HTTPCORE-727
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


      at 3bc973a9e HTTPCORE-727: Protocol handlers fail to update input metrics when receive input data from a TLS encrypted I/O session

This branch includes the following new commits:

     new 3bc973a9e HTTPCORE-727: Protocol handlers fail to update input metrics when receive input data from a TLS encrypted I/O session

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.



[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 HTTPCORE-727
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 3bc973a9ea822f6cf433982ded5894f760e74541
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
---
 .../java/org/apache/hc/core5/http2/impl/nio/FrameInputBuffer.java    | 5 ++++-
 .../apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java   | 2 ++
 2 files changed, 6 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/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()) {