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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to