Skip to content

Commit a1ac952

Browse files
committed
workaround
1 parent 12a3c94 commit a1ac952

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/Http2Demux.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ private[http2] class Http2ClientDemux(http2Settings: Http2ClientSettings, master
5959
extends Http2Demux(http2Settings, initialRemoteSettings = Nil, upgraded = false, isServer = false) {
6060

6161
def wrapTrailingHeaders(headers: ParsedHeadersFrame): Option[ChunkStreamPart] = {
62-
val headerParser = masterHttpHeaderParser.createShallowCopy()
6362
Some(LastChunk(extension = "",
6463
headers.keyValuePairs.map {
6564
case (name, value: HttpHeader) => value
66-
case (name, value) => parseHeaderPair(headerParser, name, value.asInstanceOf[String])
65+
case (name, value) =>
66+
val headerParser = masterHttpHeaderParser.createShallowCopy()
67+
parseHeaderPair(headerParser, name, value.asInstanceOf[String])
6768
}.toList))
6869
}
6970

http-core/src/main/scala/org/apache/pekko/http/impl/engine/http2/RequestParsing.scala

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,16 @@ private[http2] object RequestParsing {
191191

192192
private[http2] def parseHeaderPair(httpHeaderParser: HttpHeaderParser, name: String, value: String): HttpHeader = {
193193
import HttpHeader.ParsingResult
194-
HttpHeader.parse(name, value, httpHeaderParser.settings) match {
195-
case ParsingResult.Ok(header, errors) if errors.isEmpty => header
196-
case ParsingResult.Ok(_, errors) => throw ParsingException(errors.head)
197-
case ParsingResult.Error(info) => throw ParsingException(info)
194+
if (name.startsWith(":")) {
195+
val concHeaderLine = s"$name: $value\r\nx"
196+
httpHeaderParser.parseHeaderLine(pekko.util.ByteString(concHeaderLine))()
197+
httpHeaderParser.resultHeader
198+
} else {
199+
HttpHeader.parse(name, value, httpHeaderParser.settings) match {
200+
case ParsingResult.Ok(header, errors) if errors.isEmpty => header
201+
case ParsingResult.Ok(_, errors) => throw ParsingException(errors.head)
202+
case ParsingResult.Error(info) => throw ParsingException(info)
203+
}
198204
}
199205
}
200206

0 commit comments

Comments
 (0)