Class Http2Options

java.lang.Object
org.microproxy.Http2Options

public final class Http2Options extends Object
Limits for HTTP/2 client connections (HttpProxyServerBootstrap.withHttp2(boolean)). Every value has a default meant for browsers and API clients; a peer that goes past a limit gets its stream refused or reset, or the connection closed with GOAWAY. The window sizes apply to the proxy's connections to servers too (HttpProxyServerBootstrap.withHttp2Upstream(boolean)), and Http2Options.Builder.coalesceConnections(boolean) lets those serve more than one server name.

The rate limits count frames received within one window (10 seconds by default); the count starts again with each window.


 MicroProxy.bootstrap()
         .withManInTheMiddle(mitm)      // HTTP/2 to clients and servers is on by default
         .withHttp2Options(Http2Options.builder().maxConcurrentStreams(250).build())
         .start();
 
  • Field Details

  • Method Details

    • builder

      public static Http2Options.Builder builder()
      Starts a builder with the default settings.
      Returns:
      a new builder with default settings
    • toBuilder

      public Http2Options.Builder toBuilder()
      Starts a builder initialized with these settings.
      Returns:
      a new builder initialized with these settings
    • maxConcurrentStreams

      public int maxConcurrentStreams()
      SETTINGS_MAX_CONCURRENT_STREAMS: streams a client may have open at once.
      Returns:
      the maximum simultaneous client streams
    • initialWindowSize

      public int initialWindowSize()
      SETTINGS_INITIAL_WINDOW_SIZE: request body bytes buffered per stream, at most.
      Returns:
      the stream receive window size in bytes
    • connectionWindowSize

      public int connectionWindowSize()
      Returns the connection's receive window: request body bytes buffered per connection, at most.
      Returns:
      the connection's receive window: request body bytes buffered per connection, at most
    • maxHeaderListSize

      public int maxHeaderListSize()
      SETTINGS_MAX_HEADER_LIST_SIZE, or 0 for the default: the proxy's max_header_size plus max_initial_line_length, the same room an HTTP/1 request head has.
      Returns:
      the maximum header list size in bytes, or zero to derive it from HTTP/1 limits
    • settingsAckTimeout

      public Duration settingsAckTimeout()
      Returns how long the client may take to acknowledge the proxy's SETTINGS.
      Returns:
      how long the client may take to acknowledge the proxy's SETTINGS
    • rateWindow

      public Duration rateWindow()
      Returns the window the rate limits count frames in.
      Returns:
      the window the rate limits count frames in
    • maxRapidResets

      public int maxRapidResets()
      Returns streams the client may reset (or open past the concurrency limit) before they complete, per window.
      Returns:
      streams the client may reset (or open past the concurrency limit) before they complete, per window
    • maxPings

      public int maxPings()
      PING frames per window.
      Returns:
      the maximum PING frames per rate window
    • maxSettings

      public int maxSettings()
      SETTINGS frames per window.
      Returns:
      the maximum SETTINGS frames per rate window
    • maxResets

      public int maxResets()
      RST_STREAM and PRIORITY frames per window.
      Returns:
      the maximum RST_STREAM and PRIORITY frames per rate window
    • maxWindowUpdates

      public int maxWindowUpdates()
      WINDOW_UPDATE frames per window.
      Returns:
      the maximum WINDOW_UPDATE frames per rate window
    • maxEmptyFrames

      public int maxEmptyFrames()
      DATA frames without data or END_STREAM, and empty trailing HEADERS, per window.
      Returns:
      the maximum empty frames per rate window
    • coalesceConnections

      public boolean coalesceConnections()
      Whether an HTTP/2 connection to a server may carry requests for other server names than the one it was made for (connection coalescing, RFC 9113 section 9.1.1).
      Returns:
      true if connections to servers are coalesced
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object