Skip to content

H2 upgrade - #13

Merged
pgit merged 7 commits into
masterfrom
h2-upgrade
Sep 13, 2026
Merged

pgit merged 7 commits into
masterfrom
h2-upgrade

Conversation

@pgit

@pgit pgit commented Sep 13, 2026

Copy link
Copy Markdown
Owner

No description provided.

pgit and others added 7 commits September 12, 2026 15:16
A cleartext HTTP/1.1 request carrying "Upgrade: h2c" (RFC 7540, section 3.2) is answered
with "101 Switching Protocols". The stream and the remaining buffer are handed over to an
HTTP/2 server session, which applies the HTTP2-Settings via nghttp2_session_upgrade2() and
continues the request as stream 1.

Only requests without a body are upgraded; otherwise, and for malformed upgrade requests,
the upgrade is ignored and the request is served as HTTP/1.1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
H2CUpgrade drives a bare nghttp2 client session by hand, so that the handshake is under
the test's control: the upgraded request continues as stream 1 and the connection takes
further streams afterwards. Requests with a body and requests with missing or invalid
HTTP2-Settings must be served as HTTP/1.1 instead.

ExternalCustom.curl_h2c_upgrade checks the same with curl --http2 against an http:// URL,
where both requests must be answered over HTTP/2.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The ExternalTLS curl tests closed their argument lists with a second "clang-format off"
instead of "on", which left formatting disabled for the rest of the file. Now that it
applies again, format the h2c upgrade tests and guard their curl arguments the same way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
test_server.cpp had grown to more than 2400 lines. The fixtures used by several files
(Server, Client, ClientAsync) move to test_fixtures.hpp; everything else goes next to the
tests using it:

  test_server.cpp                     Server, Http3IdleTimeout
  test_client_connect.cpp             ClientConnect
  test_external.cpp                   External, ExternalTLS(Threaded), ExternalCustom
  test_h2c_upgrade.cpp                H2CUpgrade
  test_client_async.cpp               ClientAsync
  test_client_async_cancellation.cpp  backpressure, cancellation and connection loss
  test_file_handler.cpp               FileHandler

Each file includes what it uses on top of the shared header.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A test suite should not be spread across several files. The tests in
test_client_async_cancellation.cpp now use ClientAsyncCancellation, derived from
ClientAsync and instantiated for all three protocols.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@pgit
pgit merged commit 913374c into master Sep 13, 2026
4 checks passed
@pgit
pgit deleted the h2-upgrade branch September 13, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant