Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Header buffering can duplicate headers and discard buffered headers for some error responses.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR buffers response headers until remote filename selection is complete, with regression coverage for Early Hints and ETag handling.
Changes:
- Adds deferred header buffering.
- Handles 103 responses and ETag-saving behavior.
- Registers tests 3037 and 3038.
File summaries
| File | Changes |
|---|---|
src/tool_cb_hdr.c |
Buffers headers during filename selection. |
tests/data/test3037 |
Tests Early Hints behavior. |
tests/data/test3038 |
Tests ETag and header buffering. |
tests/data/Makefile.am |
Registers the new tests. |
Review details
Suppressed comments (1)
src/tool_cb_hdr.c:518
- This also buffers headers for 4xx/5xx responses, even though the
content_disposition()branch is deliberately skipped for those response classes and cannot select a filename. For a zero-length error response (for example,404 Content-Length: 0), the write callback never runs, so the output file is never opened and the buffered-iheaders are discarded during cleanup. Restrict this deferral to response classes that can still complete the filename decision (including 1xx for Early Hints), or create/flush the output at the end of headers for error responses.
if(hdrcbdata->honor_cd_filename)
return buffer_header(hdrcbdata, str, cb);
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
The new fallback incorrectly buffers and can discard headers for bodyless non-HTTP responses.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
src/tool_cb_hdr.c:522
- Restrict this buffering fallback to HTTP(S).
honor_cd_filenameis set solely from-Jplus-O(tool_operate.c:1229), even though-Jonly applies to HTTP, while this output block also handles RTSP andfile. For an RTSP bodyless response, every-iheader now takes this return path, no body callback flushesheadlist, and cleanup discards the headers without creating/writing the remote-name output file.
- Files reviewed: 4/4 changed files
- Comments generated: 0 new
- Review effort level: Balanced
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.