pjfanning opened a new pull request, #1394: URL: https://github.com/apache/pekko-http/pull/1394
**Stacked on #1265.** This branch includes the two #1265 commits, because it uses the `empty-data-no-end-stream` alias added there. Review only the last commit, `feat: add a frame type throttle to the HTTP/2 client`; the diff shrinks to that once #1265 is merged. ### Motivation The HTTP/2 server can rate-limit incoming frames by type through `pekko.http.server.http2.frame-type-throttle`, but the client stack had no equivalent and no setting for one, so there was no way to limit what a server sends to a client connection. ### Modification - Add `pekko.http.client.http2.frame-type-throttle` with the same `frame-types`, `cost`, `burst` and `interval` settings and aliases as the server. The default is `["reset", "empty-data-no-end-stream"]`. - Add the matching settings to the scaladsl and javadsl `Http2ClientSettings`, with a MiMa exclude for the new abstract methods on the `@DoNotInherit` trait. - Generalise the server's throttle bidi in `Http2Blueprint` so that it takes the frame types, cost, interval and burst, and insert it between HPACK and framing in `clientStack`. - Add a 1.x→2.x migration guide entry. A server can legitimately reset streams, for example with `REFUSED_STREAM` at its concurrency limit, or with `NO_ERROR` after a complete response that arrives before the request body has been fully sent. The config comment and migration guide note that a client with many requests in flight on one connection may need a higher limit. ### Result A client connection is failed when the server sends more `RST_STREAM` frames, or empty DATA frames that do not end their stream, than the configured rate allows. Set `frame-types = []` to disable it. ### Tests - `sbt "http2-tests/testOnly ...Http2ClientSpec ...Http2ClientServerSpec ...Http2PersistentClientSpec"`: pass (56 tests, 1 pending). New cases cover an `RST_STREAM` flood and an empty DATA flood failing the connection by default, and the throttle being disabled. Verified that both flood cases fail with the client default set to `[]`. - `sbt "http-core/testOnly ...Http2BlueprintSpec"`: pass (17 tests). - `sbt http-core/mimaReportBinaryIssues`: pass. - Native `scalafmt` clean. sbt does not manage headers for `.excludes` files, so the new one carries the same header as its siblings. ### References Fixes #1393 Depends on #1265 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
