H2 upgrade - #13
Merged
Merged
H2 upgrade#13
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.