You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2025/09/26 00:35:42 UTC

[PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

pjfanning opened a new pull request, #800:
URL: https://github.com/apache/pekko-http/pull/800

   * experiment for #798 
   * WIP


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399420967


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,18 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {
+      val concHeaderLine = s"$name: $value\r\nx"
+      httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
+      httpHeaderParser.resultHeader
+    } else {
+      HttpHeader.parse(name, value, httpHeaderParser.settings) match {

Review Comment:
   Maybe it's a typo in the test? Is `:grpc-status` a thing, i.e. is it allowed for gRPC (outside the HTTP/2 spec) to extend the set of `:` pseudo headers?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399448392


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,21 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {

Review Comment:
   Maybe just a look ahead char is better



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399419608


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,18 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {
+      val concHeaderLine = s"$name: $value\r\nx"
+      httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
+      httpHeaderParser.resultHeader
+    } else {
+      HttpHeader.parse(name, value, httpHeaderParser.settings) match {

Review Comment:
   I'll debug it later. There is an existing test that relies on the header parser not failing. Whether it needs the parser to actually process the pseudo header at all is something that I haven't yet tested.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399410575


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,18 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {
+      val concHeaderLine = s"$name: $value\r\nx"
+      httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
+      httpHeaderParser.resultHeader
+    } else {
+      HttpHeader.parse(name, value, httpHeaderParser.settings) match {

Review Comment:
   Yeah, that's annoying



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399422482


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,18 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {
+      val concHeaderLine = s"$name: $value\r\nx"
+      httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
+      httpHeaderParser.resultHeader
+    } else {
+      HttpHeader.parse(name, value, httpHeaderParser.settings) match {

Review Comment:
   pekko-grpc also doesn't use the colon form so maybe it's just a typo and we could just fix the test.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #800:
URL: https://github.com/apache/pekko-http/pull/800#issuecomment-3361696201

   Breaks 1 Http2ClientSpec test
   
   ```
   - should send data frames to entity stream and ignore trailing headers *** FAILED *** (74 milliseconds)
   [info]     java.lang.AssertionError: assertion failed: expected OnComplete, found OnError(org.apache.pekko.http.scaladsl.model.ParsingException: Illegal HTTP header name: :grpc-status
   [info] 	at org.apache.pekko.http.impl.engine.http2.RequestParsing$.parseHeaderPair(RequestParsing.scala:197)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2ClientDemux.$anonfun$wrapTrailingHeaders$1(Http2Demux.scala:66)
   [info] 	at scala.collection.immutable.Vector1.map(Vector.scala:2141)
   [info] 	at scala.collection.immutable.Vector1.map(Vector.scala:386)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2ClientDemux.wrapTrailingHeaders(Http2Demux.scala:64)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2Demux$Logic$1$.wrapTrailingHeaders(Http2Demux.scala:243)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2StreamHandling$IncomingStreamBuffer.onTrailingHeaders(Http2StreamHandling.scala:634)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2StreamHandling$ReceivingDataWithBuffer.onTrailer(Http2StreamHandling.scala:499)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2StreamHandling$ReceivingData.handle(Http2StreamHandling.scala:478)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2StreamHandling.handleStreamEvent(Http2StreamHandling.scala:118)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2StreamHandling.handleStreamEvent$(Http2StreamHandling.scala:117)
   [info] 	at org.apache.pekko.http.impl.engine.http2.Http2Demux$Logic$1$$anon$1.onPush(Http2Demux.scala:236)
   [info] 	at org.apache.pekko.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:556)
   [info] 	at org.apache.pekko.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:434)
   [info] 	at org.apache.pekko.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:662)
   [info] 	at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute(ActorGraphInterpreter.scala:71)
   [info] 	at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter$SimpleBoundaryEvent.execute$(ActorGraphInterpreter.scala:67)
   [info] 	at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter$BatchingActorInputBoundary$OnNext.execute(ActorGraphInterpreter.scala:114)
   [info] 	at org.apache.pekko.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:637)
   [info] 	at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter.org$apache$pekko$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:813)
   [info] 	at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:831)
   [info] 	at org.apache.pekko.actor.Actor.aroundReceive(Actor.scala:547)
   [info] 	at org.apache.pekko.actor.Actor.aroundReceive$(Actor.scala:545)
   [info] 	at org.apache.pekko.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:729)
   [info] 	at org.apache.pekko.actor.ActorCell.receiveMessage(ActorCell.scala:590)
   [info] 	at org.apache.pekko.actor.ActorCell.invoke(ActorCell.scala:557)
   [info] 	at org.apache.pekko.dispatch.Mailbox.processMailbox(Mailbox.scala:272)
   [info] 	at org.apache.pekko.dispatch.Mailbox.run(Mailbox.scala:233)
   [info] 	at org.apache.pekko.dispatch.Mailbox.exec(Mailbox.scala:245)
   [info] 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
   [info] 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
   [info] 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
   [info] 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
   [info] 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
   [info] )
   [info]     at scala.Predef$.assert(Predef.scala:279)
   [info]     at org.apache.pekko.testkit.TestKitBase.expectMsg_internal(TestKit.scala:473)
   [info]     at org.apache.pekko.testkit.TestKitBase.expectMsg(TestKit.scala:449)
   [info]     at org.apache.pekko.testkit.TestKitBase.expectMsg$(TestKit.scala:449)
   [info]     at org.apache.pekko.testkit.TestKit.expectMsg(TestKit.scala:982)
   [info]     at org.apache.pekko.stream.testkit.TestSubscriber$ManualProbe.expectComplete(StreamTestKit.scala:632)
   [info]     at org.apache.pekko.http.impl.engine.ws.ByteStringSinkProbe$$anon$1.expectComplete(ByteStringSinkProbe.scala:112)
   [info]     at org.apache.pekko.http.impl.engine.http2.Http2ClientSpec$$anon$19.<init>(Http2ClientSpec.scala:422)
   [info]     at org.apache.pekko.http.impl.engine.http2.Http2ClientSpec.$anonfun$new$26(Http2ClientSpec.scala:413)
   [info]     at org.apache.pekko.http.impl.engine.http2.Http2ClientSpec$InWithStoppedStages.$anonfun$inAssertAllStagesStopped$2(Http2ClientSpec.scala:963)
   [info]     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
   [info]     at org.apache.pekko.stream.testkit.scaladsl.StreamTestKit$.assertAllStagesStopped(StreamTestKit.scala:42)
   [info]     at org.apache.pekko.http.impl.engine.http2.Http2ClientSpec$InWithStoppedStages.$anonfun$inAssertAllStagesStopped$1(Http2ClientSpec.scala:962)
   [info]     at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
   [info]     at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
   [info]     at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
   [info]     at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
   [info]     at org.scalatest.Transformer.apply(Transformer.scala:22)
   [info]     at org.scalatest.Transformer.apply(Transformer.scala:20)
   [info]     at org.scalatest.wordspec.AnyWordSpecLike$$anon$3.apply(AnyWordSpecLike.scala:1240)
   [info]     at org.apache.pekko.http.impl.util.WithLogCapturing.$anonfun$withFixture$1(WithLogCapturing.scala:65)
   [info]     at org.apache.pekko.testkit.EventFilter.intercept(TestEventListener.scala:129)
   [info]     at org.apache.pekko.http.impl.util.WithLogCapturing.withFixture(WithLogCapturing.scala:63)
   [info]     at org.apache.pekko.http.impl.util.WithLogCapturing.withFixture$(WithLogCapturing.scala:50)
   [info]     at org.apache.pekko.http.impl.util.PekkoSpecWithMaterializer.withFixture(PekkoSpecWithMaterializer.scala:24)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399366839


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,18 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {
+      val concHeaderLine = s"$name: $value\r\nx"
+      httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
+      httpHeaderParser.resultHeader
+    } else {
+      HttpHeader.parse(name, value, httpHeaderParser.settings) match {

Review Comment:
   In general that's really cleaner. I don't expect a performance hit, there's a bit of a difference of how the parsers are looked up between `HttpHeader.parse` and `httpHeaderParser.parseHeaderLine`. `HttpHeader.parse` uses binary search to find the right parser and `httpHeaderParser.parseHeaderLine` uses kind of a lut / radix lookup once the parser is primed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399400593


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,18 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {
+      val concHeaderLine = s"$name: $value\r\nx"
+      httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
+      httpHeaderParser.resultHeader
+    } else {
+      HttpHeader.parse(name, value, httpHeaderParser.settings) match {

Review Comment:
   Thanks @jrudolph.
   I had to use the `startsWith(":")` check because `HttpHeader.parse` doesn't support pseudo headers and 1 test includes a `:grpc-status` pseudo header.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] avoid ByteString when parsing HTTP/2 headers [pekko-http]

Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on code in PR #800:
URL: https://github.com/apache/pekko-http/pull/800#discussion_r2399414343


##########
http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala:
##########
@@ -191,13 +190,18 @@ private[http2] object RequestParsing {
   }
 
   private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
-    // FIXME: later modify by adding HttpHeaderParser.parseHttp2Header that would use (name, value) pair directly
-    //        or use a separate, simpler, parser for Http2
-    // The odd-looking 'x' below is a by-product of how current parser and HTTP/1.1 work.
-    // Without '\r\n\x' (x being any additional byte) parsing will fail. See HttpHeaderParserSpec for examples.
-    val concHeaderLine = name + ": " + value + "\r\nx"
-    httpHeaderParser.parseHeaderLine(ByteString(concHeaderLine))()
-    httpHeaderParser.resultHeader
+    import HttpHeader.ParsingResult
+    if (name.startsWith(":")) {
+      val concHeaderLine = s"$name: $value\r\nx"
+      httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
+      httpHeaderParser.resultHeader
+    } else {
+      HttpHeader.parse(name, value, httpHeaderParser.settings) match {

Review Comment:
   But wait, does it even parse it into anything useful?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org