feat(http2): implement HTTP/2 server with TLS and h2c support#438
Merged
Conversation
…ling Add http2_request struct to represent incoming HTTP/2 requests with: - Pseudo-headers parsing (:method, :path, :scheme, :authority) - Regular headers storage - Helper methods for content-type, content-length - Request body handling from DATA frames - Validation for RFC 7540 compliance Part of #406, closes #433
Implement http2_server_stream class providing server-side stream handling: - Response headers with status code via HPACK encoding - Data frame sending with automatic frame splitting - Streaming response support (start_response, write, end_response) - Stream reset functionality - Flow control window management - Thread-safe state management Part of #406, closes #434
Add HTTP/2 server implementation with: - http2_server: Main server class with TLS and non-TLS support - http2_server_connection: Per-connection handler with frame processing - Connection acceptance with ALPN "h2" negotiation - SETTINGS exchange per RFC 7540 - Stream multiplexing support - Flow control (connection and stream level) - HPACK header compression/decompression - Request handler callback API - Cleanup timer for dead connections - Proper GOAWAY handling on shutdown Also updates CMakeLists.txt to include new source files. Part of #406, closes #435
Example demonstrates: - Server creation and configuration - HTTP/2 settings customization - Request handler with routing - Various endpoints (health check, echo, POST data) - Graceful shutdown handling The example uses h2c (HTTP/2 cleartext) for simplicity. Production usage should use start_tls() with proper certificates. Refs #406 Closes #437
- Add HTTP/2 server implementation entry to CHANGELOG.md - Update FEATURES.md roadmap: HTTP/2 now complete - Update planned enhancements to reference http2_server class Refs #406
Contributor
Performance ComparisonBase Branch ResultsNo base results PR Branch ResultsNo PR results |
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
* feat(http2): add http2_request structure for server-side request handling Add http2_request struct to represent incoming HTTP/2 requests with: - Pseudo-headers parsing (:method, :path, :scheme, :authority) - Regular headers storage - Helper methods for content-type, content-length - Request body handling from DATA frames - Validation for RFC 7540 compliance Part of #406, closes #433 * feat(http2): add http2_server_stream class for response handling Implement http2_server_stream class providing server-side stream handling: - Response headers with status code via HPACK encoding - Data frame sending with automatic frame splitting - Streaming response support (start_response, write, end_response) - Stream reset functionality - Flow control window management - Thread-safe state management Part of #406, closes #434 * feat(http2): implement http2_server class for HTTP/2 server support Add HTTP/2 server implementation with: - http2_server: Main server class with TLS and non-TLS support - http2_server_connection: Per-connection handler with frame processing - Connection acceptance with ALPN "h2" negotiation - SETTINGS exchange per RFC 7540 - Stream multiplexing support - Flow control (connection and stream level) - HPACK header compression/decompression - Request handler callback API - Cleanup timer for dead connections - Proper GOAWAY handling on shutdown Also updates CMakeLists.txt to include new source files. Part of #406, closes #435 * Add unit tests for HTTP/2 server implementation Add comprehensive tests for: - http2_request: header parsing, content helpers, validation, from_headers - http2_server: construction, settings, lifecycle, handlers - http2_settings: default values - tls_config: default values and property setting All 28 tests passing. Refs #406 Closes #436 * Add HTTP/2 server example demonstrating basic usage Example demonstrates: - Server creation and configuration - HTTP/2 settings customization - Request handler with routing - Various endpoints (health check, echo, POST data) - Graceful shutdown handling The example uses h2c (HTTP/2 cleartext) for simplicity. Production usage should use start_tls() with proper certificates. Refs #406 Closes #437 * Update documentation for HTTP/2 server implementation - Add HTTP/2 server implementation entry to CHANGELOG.md - Update FEATURES.md roadmap: HTTP/2 now complete - Update planned enhancements to reference http2_server class Refs #406
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.
Summary
Changes
New Files
include/kcenon/network/protocols/http2/http2_request.h- HTTP/2 request structureinclude/kcenon/network/protocols/http2/http2_server.h- Server and connection classesinclude/kcenon/network/protocols/http2/http2_server_stream.h- Response stream handlingsrc/protocols/http2/http2_server.cpp- Server implementationsrc/protocols/http2/http2_server_stream.cpp- Stream implementationtests/test_http2_server.cpp- Unit testssamples/http2_server_example.cpp- Usage exampleFeatures
start_tls()start()Test Plan
Closes #406
Closes #433, #434, #435, #436, #437