Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ private[http2] final class HeaderDecompression(masterHeaderParser: HttpHeaderPar
}
}
try {
decoder.decode(ByteStringInputStream(payload), Receiver)
val inputStream = payload.asInputStream
try {
decoder.decode(inputStream, Receiver)
} finally {
inputStream.close()
}
decoder.endHeaderBlock() // TODO: do we have to check the result here?

push(eventsOut, ParsedHeadersFrame(streamId, endStream, headers.result(), prioInfo))
} catch {
case ex: IOException =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package org.apache.pekko.http.impl.engine.http2

import org.apache.pekko
import pekko.http.impl.engine.http2.hpack.ByteStringInputStream
import pekko.http.scaladsl.model.headers.RawHeader
import pekko.http.scaladsl.model._
import pekko.http.shaded.com.twitter.hpack._
Expand Down Expand Up @@ -58,10 +57,9 @@ trait Http2FrameHpackSupport extends Http2FrameProbeDelegator with Http2FrameSen
val decoder = new Decoder(Http2Protocol.InitialMaxHeaderListSize, Http2Protocol.InitialMaxHeaderTableSize)

def decodeHeaders(bytes: ByteString): Seq[(String, String)] = {
val bis = ByteStringInputStream(bytes)
val hs = new VectorBuilder[(String, String)]()

decoder.decode(bis,
decoder.decode(bytes.asInputStream,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try finally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is test code so I didn't think the close was as important

new HeaderListener {
def addHeader(name: String, value: String, parsedValue: AnyRef, sensitive: Boolean): AnyRef = {
hs += name -> value
Expand Down
Loading