Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Remove ByteStringInputStream
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.impl.engine.http2.hpack.ByteStringInputStream")
ProblemFilters.exclude[MissingClassProblem]("org.apache.pekko.http.impl.engine.http2.hpack.ByteStringInputStream$")

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ private[http2] final class HeaderDecompression(masterHeaderParser: HttpHeaderPar
}
}
}
val bis = ByteStringInputStream(payload)
val stream = payload.compact.asInputStream
try {
decoder.decode(bis, Receiver)
decoder.decode(stream, Receiver) // only compact ByteString supports InputStream with mark/reset
decoder.endHeaderBlock() // TODO: do we have to check the result here?

push(eventsOut, ParsedHeadersFrame(streamId, endStream, headers.result(), prioInfo))
Expand All @@ -104,7 +104,7 @@ private[http2] final class HeaderDecompression(masterHeaderParser: HttpHeaderPar
fail(eventsOut,
new Http2Compliance.Http2ProtocolException(ErrorCode.COMPRESSION_ERROR, "Decompression failed."))
} finally {
bis.close()
stream.close()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package org.apache.pekko.http.impl.engine.http2
import scala.collection.immutable.VectorBuilder

import org.apache.pekko
import pekko.http.impl.engine.http2.hpack.ByteStringInputStream
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.model.headers.RawHeader
import pekko.http.shaded.com.twitter.hpack._
Expand Down Expand Up @@ -60,16 +59,13 @@ trait Http2FrameHpackSupport extends Http2FrameProbeDelegator with Http2FrameSen

def decodeHeaders(bytes: ByteString): Seq[(String, String)] = {
val hs = new VectorBuilder[(String, String)]()
val bis = ByteStringInputStream(bytes)
try
decoder.decode(bis,
new HeaderListener {
def addHeader(name: String, value: String, parsedValue: AnyRef, sensitive: Boolean): AnyRef = {
hs += name -> value
parsedValue
}
})
finally bis.close()
decoder.decode(bytes.compact.asInputStream,
new HeaderListener {
def addHeader(name: String, value: String, parsedValue: AnyRef, sensitive: Boolean): AnyRef = {
hs += name -> value
parsedValue
}
})
hs.result()
}
def decodeHeadersToResponse(bytes: ByteString): HttpResponse =
Expand Down