Clean up the HTTP/2 client SETTINGS code that has no effect, and make the client's SETTINGS values configurable

Open
#187 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java

Research direction

Start with HTTP2JettyClient property loading and the CustomHTTP2ClientConnectionFactory.onOpen() code that builds the client SETTINGS frame; trace how h2 over TLS and both h2c modes configure their clients. Then inspect the README property table and docs/http-debug-notes.md. Done means the configured settings and h2c header agree across all three modes, defaults remain compatible, and the acceptance capture tests pass.

Written by the indexing model from the issue text.

Description

bug

Related: #41

Background

HTTP2JettyClient has a block labelled "Experimental HTTP/2 SETTINGS frame configuration" with these fields:

  • settingsHeaderTableSize
  • settingsMaxConcurrentStreams
  • settingsInitialWindowSize
  • settingsMaxFrameSize
  • settingsMaxHeaderListSize
  • disableServerPush

It applies them to Jetty's HTTP2Client through reflection, guarded by hasMethod. On Jetty 12 (12.1.11), HTTP2Client has no setInitialStreamWindowSize, setMaxConcurrentStreams, setMaxHeaderListSize or setHeaderTableSize method. hasMethod therefore skips those calls without any error. The only call that runs is setMaxFrameSize(16384), which is already Jetty's default.

The client's SETTINGS frame is built by CustomHTTP2ClientConnectionFactory from HTTP2Client getters, so none of these fields reaches it.

Problems found

  1. The fields have no effect on the SETTINGS frame sent over TLS (h2).
  2. The h2c upgrade disagrees with the real frame. buildH2cSettingsHeaderValue() builds the HTTP2-Settings header of the h2c upgrade request from these fields. The SETTINGS frame sent after the upgrade uses different values:
    • INITIAL_WINDOW_SIZE is 65535 in the header and 8388608 in the frame.
    • MAX_HEADER_LIST_SIZE is 4096 in the header and is not sent in the frame. Since the frame does not override it, the server keeps 4096 from the header.
  3. blazemeter.http.settingsMaxHeaderListSize does not do what the README says. The README describes it as HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE. It is only used in the h2c upgrade header and in a warning that never fires (see 4).
  4. The listener that should log the server's SETTINGS never runs. It is registered by reflection through HTTP2Client.addSessionListener, which does not exist in Jetty 12. So the received SETTINGS are never logged, and the warning about the server's SETTINGS_MAX_HEADER_LIST_SIZE never fires. That warning also compares against the wrong value: the server's MAX_HEADER_LIST_SIZE limits the client's request headers, not its response headers.
  5. blazemeter.http.skipHttp2Settings does nothing. It is documented in docs/http-debug-notes.md, but it only skips the setMaxFrameSize(16384) call, which changes nothing.
  6. disableServerPush cannot be turned on. No property sets it, so it is always false and its branches never run.

What Jetty 12 lets us configure

The client's SETTINGS frame is built in our own CustomHTTP2ClientConnectionFactory.onOpen(). Each parameter maps to a public HTTP2Client setter, or can be added there directly.

SETTINGS parameter Existing field (default) Sent today Jetty 12 source Proposal
HEADER_TABLE_SIZE (0x1) settingsHeaderTableSize (4096) 4096 (omitted because it is the default) setMaxDecoderTableCapacity Reuse the field and apply it through this setter.
ENABLE_PUSH (0x2) disableServerPush (false, no property) not sent, so the server assumes push is enabled no setter; add it in onOpen() Make it configurable. When push is disabled, send ENABLE_PUSH=0 and set maxConcurrentPushedStreams to 0. If we decide not to support it, remove disableServerPush.
MAX_CONCURRENT_STREAMS (0x3) settingsMaxConcurrentStreams (100) maxConcurrentPushedStreams (blazemeter.http.maxConcurrentPushedStreams, 100) setMaxConcurrentPushedStreams Remove the field: the existing property already sets this value. It limits server-initiated (push) streams, not the client's requests.
INITIAL_WINDOW_SIZE (0x4) settingsInitialWindowSize (65535) 8388608 (Jetty default) setInitialStreamRecvWindow Reuse the field with default 8388608. A 65535 default would shrink the flow-control window and reduce throughput. Consider also exposing setInitialSessionRecvWindow (16 MiB, sent as a connection WINDOW_UPDATE).
MAX_FRAME_SIZE (0x5) settingsMaxFrameSize (16384) 16384 (omitted because it is the default) setMaxFrameSize Reuse the field and validate the RFC 9113 range (16384 to 16777215).
MAX_HEADER_LIST_SIZE (0x6) settingsMaxHeaderListSize (4096, property) not sent (setMaxResponseHeadersSize(-1)) setMaxResponseHeadersSize Reuse the property, keeping unlimited as the default. This setter also caps response header parsing, so a 4096 default would reject responses with larger headers.

Proposal

  • Call the HTTP2Client setters directly instead of through reflection. Jetty is bundled and relocated in the plugin jar at a known version, so the hasMethod guards only hide mismatches like these.
  • Wire each field to its Jetty 12 source as in the table, through blazemeter.http.settings* properties (settingsMaxHeaderListSize already follows this pattern). Read them in loadProperties.
  • Remove what has no valid target: settingsMaxConcurrentStreams, plus disableServerPush if push control is not added.
  • Apply the same values to the h2c clients (upgrade and prior knowledge). Build the HTTP2-Settings header from the values the SETTINGS frame actually sends, so the two always agree.
  • Replace the reflection-based listener with one that works in Jetty 12, or remove it and its warning. If the warning is kept, compare the server's MAX_HEADER_LIST_SIZE with the request headers being sent.
  • Remove blazemeter.http.skipHttp2Settings, or make it skip the new configuration.
  • Update the README property table and docs/http-debug-notes.md.

Acceptance criteria

  • A test against a local HTTP/2 server captures the client's SETTINGS frame and checks, for each property, that the configured value is sent. Run it for h2 over TLS, for h2c with upgrade and for h2c with prior knowledge.
  • With no properties set, the SETTINGS frame is the same as today (in particular INITIAL_WINDOW_SIZE=8388608, and no MAX_HEADER_LIST_SIZE limit on responses).
  • The HTTP2-Settings header of an h2c upgrade matches the SETTINGS frame sent after the upgrade.
  • No reflection remains for HTTP2Client settings, and no documented property or flag is left without effect.

Notes

  • Jetty's HTTP/2 transport can copy some values from HttpClient onto HTTP2Client when it starts (for example maxResponseHeadersSize). The capture test should confirm that the configured values survive that step.
  • HTTP/3 settings are out of scope.
Dominant language
Java
Stars
51
Forks
30
Avg merge
2d 22h
Merged PRs (30d)
8

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Blazemeter/jmeter-http-plugin

All issues in Blazemeter/jmeter-http-plugin

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.