Skip to content

tool_cb_hdr: do not truncate etags output to stdout - #22685

Closed
bagder wants to merge 3 commits into
masterfrom
bagder/etags-stdout
Closed

bagder wants to merge 3 commits into
masterfrom
bagder/etags-stdout

Conversation

@bagder

@bagder bagder commented Aug 26, 2026

Copy link
Copy Markdown
Member

Verified by test 321

Reported-by: Stanislav Fort

Verified by test 321

Reported-by: Stanislav Fort
@bagder
bagder marked this pull request as ready for review August 26, 2026 10:02
@bagder
bagder requested a lite review from Copilot August 26, 2026 10:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes --etag-save - behavior when stdout is redirected (e.g., >> file) by preventing curl’s ETag-saving code from truncating the underlying stdout file descriptor, and adds a regression test to cover the scenario.

Changes:

  • Only truncate the ETag output target when it is a curl-managed regular file (not stdout) in save_etag().
  • Add a new test (321) validating that --etag-save - redirected with >> appends without truncating existing content.
  • Register the new test in the test data makefile.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/data/test321 New regression test for --etag-save - with stdout redirection + append.
tests/data/Makefile.am Adds test321 to the test list.
src/tool_cb_hdr.c Gates ETag-file truncation on OutStruct::regular_file to avoid truncating stdout.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/data/test321 Outdated
fix

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@bagder bagder closed this in 6fafe47 Aug 26, 2026
@bagder
bagder deleted the bagder/etags-stdout branch August 26, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants