Class Http2Blueprint

java.lang.Object
org.apache.pekko.http.impl.engine.http2.Http2Blueprint

public class Http2Blueprint extends Object
INTERNAL API
  • Constructor Details

    • Http2Blueprint

      public Http2Blueprint()
  • Method Details

    • serverStackTls

      public static org.apache.pekko.stream.scaladsl.BidiFlow<HttpResponse,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,HttpRequest,ServerTerminator> serverStackTls(ServerSettings settings, org.apache.pekko.event.LoggingAdapter log, TelemetrySpi telemetry, DateHeaderRendering dateHeaderRendering)
    • serverStack

      public static org.apache.pekko.stream.scaladsl.BidiFlow<HttpResponse,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,HttpRequest,ServerTerminator> serverStack(ServerSettings settings, org.apache.pekko.event.LoggingAdapter log, scala.collection.immutable.Seq<FrameEvent.Setting> initialDemuxerSettings, boolean upgraded, TelemetrySpi telemetry, DateHeaderRendering dateHeaderRendering)
    • clientStack

      public static org.apache.pekko.stream.scaladsl.BidiFlow<HttpRequest,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,HttpResponse,org.apache.pekko.NotUsed> clientStack(ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log, TelemetrySpi telemetry)
    • clientStack

      public static org.apache.pekko.stream.scaladsl.BidiFlow<HttpRequest,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,HttpResponse,org.apache.pekko.NotUsed> clientStack(ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log, TelemetrySpi telemetry, String connectionScheme, Uri.Authority connectionAuthority)
      Parameters:
      connectionScheme - the ':scheme' rendered for a request whose URI has none
      connectionAuthority - the ':authority' rendered for a request whose URI and Host header have none
      settings - (undocumented)
      log - (undocumented)
      telemetry - (undocumented)
      Returns:
      (undocumented)
    • httpLayerClient

      public static org.apache.pekko.stream.scaladsl.BidiFlow<HttpRequest,Http2SubStream,Http2SubStream,HttpResponse,org.apache.pekko.NotUsed> httpLayerClient(HttpHeaderParser masterHttpHeaderParser, ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log)
    • httpLayerClient

      public static org.apache.pekko.stream.scaladsl.BidiFlow<HttpRequest,Http2SubStream,Http2SubStream,HttpResponse,org.apache.pekko.NotUsed> httpLayerClient(HttpHeaderParser masterHttpHeaderParser, ClientConnectionSettings settings, org.apache.pekko.event.LoggingAdapter log, String connectionScheme, Uri.Authority connectionAuthority)
    • idleTimeoutIfConfigured

      public static org.apache.pekko.stream.scaladsl.BidiFlow<org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,org.apache.pekko.NotUsed> idleTimeoutIfConfigured(scala.concurrent.duration.Duration timeout)
    • errorHandling

      public static org.apache.pekko.stream.scaladsl.BidiFlow<org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,org.apache.pekko.NotUsed> errorHandling(org.apache.pekko.event.LoggingAdapter log)
    • framing

      public static org.apache.pekko.stream.scaladsl.BidiFlow<FrameEvent,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,FrameEvent,org.apache.pekko.NotUsed> framing(org.apache.pekko.event.LoggingAdapter log, int maxFrameSize)
    • framingClient

      public static org.apache.pekko.stream.scaladsl.BidiFlow<FrameEvent,org.apache.pekko.util.ByteString,org.apache.pekko.util.ByteString,FrameEvent,org.apache.pekko.NotUsed> framingClient(org.apache.pekko.event.LoggingAdapter log, int maxFrameSize)
    • EmptyDataFrameThrottleName

      public static String EmptyDataFrameThrottleName()
      Not a real frameTypeName, so it never matches one directly: frameCost(scala.collection.immutable.Set<java.lang.String>,org.apache.pekko.http.impl.engine.http2.FrameEvent) recognises it and charges every DATA frame that carries no payload.

      Such a frame consumes no flow-control window, so unlike a data-carrying one its number is not bounded by flow control at all and a peer can send them continuously. Data-carrying frames are deliberately not covered, because throttling those would throttle legitimate throughput along with them.

      Returns:
      (undocumented)
    • EmptyDataFrameNoEndStreamThrottleName

      public static String EmptyDataFrameNoEndStreamThrottleName()
      As EmptyDataFrameThrottleName(), but only for the empty DATA frames that do not carry END_STREAM. An empty DATA frame with END_STREAM is how a client closes a request body whose length it did not know up front, so it is both legitimate and self-limiting: one per stream, after which the stream is half-closed. An empty DATA frame that does not end its stream is allowed by HTTP/2 but carries nothing and closes nothing, so a well-behaved peer sends few if any, which is why this is the alias that is throttled by default (see CVE-2019-9518).
      Returns:
      (undocumented)
    • frameCost

      public static int frameCost(scala.collection.immutable.Set<String> frameTypesForThrottle, FrameEvent event)
    • frameTypeAliasToFrameTypeName

      public static scala.Option<String> frameTypeAliasToFrameTypeName(String frameType)
    • hpackCoding

      public static org.apache.pekko.stream.scaladsl.BidiFlow<FrameEvent,FrameEvent,FrameEvent,FrameEvent,org.apache.pekko.NotUsed> hpackCoding(HttpHeaderParser masterHttpHeaderParser, ParserSettings parserSettings, int maxHeaderListSize)
      Runs hpack encoding and decoding. Incoming frames that are processed are HEADERS and CONTINUATION. Outgoing frame is ParsedHeadersFrame. Other frames are propagated unchanged.

      TODO: introduce another FrameEvent type that exclude HeadersFrame and ContinuationFrame from reaching the higher-level.

      Parameters:
      masterHttpHeaderParser - (undocumented)
      parserSettings - (undocumented)
      maxHeaderListSize - (undocumented)
      Returns:
      (undocumented)
    • serverDemux

      public static org.apache.pekko.stream.scaladsl.BidiFlow<Http2SubStream,FrameEvent,FrameEvent,Http2SubStream,ServerTerminator> serverDemux(Http2ServerSettings settings, scala.collection.immutable.Seq<FrameEvent.Setting> initialDemuxerSettings, boolean upgraded)
      Creates substreams for every stream and manages stream state machines and handles priorization (TODO: later)
      Parameters:
      settings - (undocumented)
      initialDemuxerSettings - (undocumented)
      upgraded - (undocumented)
      Returns:
      (undocumented)
    • clientDemux

      public static org.apache.pekko.stream.scaladsl.BidiFlow<Http2SubStream,FrameEvent,FrameEvent,Http2SubStream,ServerTerminator> clientDemux(Http2ClientSettings settings, HttpHeaderParser masterHttpHeaderParser)
      Creates substreams for every stream and manages stream state machines and handles priorization (TODO: later)
      Parameters:
      settings - (undocumented)
      masterHttpHeaderParser - (undocumented)
      Returns:
      (undocumented)
    • httpLayer

      public static org.apache.pekko.stream.scaladsl.BidiFlow<HttpResponse,Http2SubStream,Http2SubStream,HttpRequest,org.apache.pekko.NotUsed> httpLayer(ServerSettings settings, org.apache.pekko.event.LoggingAdapter log, DateHeaderRendering dateHeaderRendering)
      Translation between substream frames and Http messages (both directions)

      To make use of parallelism requests and responses need to be associated (other than by ordering), suggestion is to add a special (virtual) header containing the streamId (or any other kind of token) is added to the HttRequest that must be reproduced in an HttpResponse. This can be done automatically for the bind API but for bindFlow the user needs to take of this manually.

      Parameters:
      settings - (undocumented)
      log - (undocumented)
      dateHeaderRendering - (undocumented)
      Returns:
      (undocumented)
    • handleWithStreamIdHeader

      public static org.apache.pekko.stream.scaladsl.Flow<HttpRequest,HttpResponse,org.apache.pekko.NotUsed> handleWithStreamIdHeader(int parallelism, scala.Function1<HttpRequest,scala.concurrent.Future<HttpResponse>> handler, scala.concurrent.ExecutionContext ec)
      Returns a flow that handles parallelism requests in parallel, automatically keeping track of the Http2StreamIdHeader between request and responses.
      Parameters:
      parallelism - (undocumented)
      handler - (undocumented)
      ec - (undocumented)
      Returns:
      (undocumented)
    • logParsingError

      public static void logParsingError(ErrorInfo info, org.apache.pekko.event.LoggingAdapter log, ParserSettings.ErrorLoggingVerbosity setting)
    • unwrapTls

      public static org.apache.pekko.stream.scaladsl.BidiFlow<org.apache.pekko.util.ByteString,org.apache.pekko.stream.TLSProtocol.SslTlsOutbound,org.apache.pekko.stream.TLSProtocol.SslTlsInbound,org.apache.pekko.util.ByteString,org.apache.pekko.NotUsed> unwrapTls()