Conversation
RaphiaRa
commented
Aug 10, 2026
Owner
- Improve test coverage for th_http and th_response
- Fix issues caught by the tests, including UB in th_http
- th_response_prepare_write finalizes headers and returns a th_response_write_plan (iov/file/offset/len), doing no I/O and dropping the th_conn dependency from th_response.h entirely - th_http_write_response now calls th_conn_send itself with the plan - fix an off-by-one in th_response_set_body_va's slow path: vsnprintf was given the formatted length instead of length + 1, truncating the last character on printf-style bodies >= 512 bytes test: rewrite th_response_test.c against the new plan-returning API - add coverage for th_set_body_from_file (missing/unknown extension, unknown root, open failure, explicit Content-Type) - add coverage for th_printf_body's slow (resize) path - add coverage for th_add_cookie (attributes, Expires, SameSite) - add coverage for th_response_reset
…n UB - too-many-connections check moved from th_http_handle_read_request to th_http_upgrader_upgrade: it was gated behind "request has a body still to read", so it silently never ran for bodyless requests (GET/HEAD/DELETE), and even when it did fire it only rejected after fully reading and parsing the request - now rejects immediately at upgrade time, before any recv - fix memcpy-param-overlap (caught by ASan) when relocating an already-buffered body to the front of the buffer before growing it; source and destination legitimately overlap here, so use memmove test: add coverage for header-too-large, body-too-large, too-many-connections, HEAD requests, and a body large enough to trigger the internal buffer growth path
It's a header, not a .c file, so the existing _bench.c exclude pattern doesn't catch it.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.