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

He-Pin pushed a commit to branch optimize-http2-strict-data-collection
in repository https://gitbox.apache.org/repos/asf/pekko-http.git

commit 169cedfa5d452d472fa55f6825d8fa4ba47ccdff
Author: 虎鸣 <[email protected]>
AuthorDate: Mon Apr 27 12:51:22 2026 +0800

    Avoid unnecessary ByteString concat for strict HTTP2 entities
---
 .../apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala
 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala
index e17ca4dc3..f59037de0 100644
--- 
a/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala
+++ 
b/http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2StreamHandling.scala
@@ -358,7 +358,10 @@ private[http2] trait Http2StreamHandling extends 
GraphStageLogic with LogHelper
       extraInitialWindow: Int) extends ReceivingData {
 
     override protected def onDataFrame(dataFrame: DataFrame): StreamState = {
-      val newData = collectedData ++ dataFrame.payload
+      val newData =
+        if (collectedData.isEmpty) dataFrame.payload
+        else if (dataFrame.payload.isEmpty) collectedData
+        else collectedData ++ dataFrame.payload
 
       if (dataFrame.endStream) {
         totalBufferedData -= newData.length


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to