Skip to content

transfer: clear referer when set to NULL#21741

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/referer
Closed

transfer: clear referer when set to NULL#21741
bagder wants to merge 1 commit into
masterfrom
bagder/referer

Conversation

@bagder
Copy link
Copy Markdown
Member

@bagder bagder commented May 25, 2026

Verify in test 1649

@github-actions github-actions Bot added the tests label May 25, 2026
@bagder bagder marked this pull request as ready for review May 25, 2026 22:19
@bagder bagder requested a review from Copilot May 25, 2026 22:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a bug where setting CURLOPT_REFERER to NULL did not clear a previously set referer from the transfer state. Adds a libtest (1649) that verifies a referer set on a first transfer is not re-sent on a subsequent transfer after being reset to NULL.

Changes:

  • In Curl_pretransfer, clear data->state.referer via Curl_bufref_free() when no referer string is set.
  • Add new test 1649 (libtest + test data) verifying referer is dropped after being NULLed.
  • Register the new test in tests/data/Makefile.am and tests/libtest/Makefile.inc.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/transfer.c Reset state.referer bufref when STRING_SET_REFERER is unset.
tests/libtest/lib1649.c New libtest: set referer, perform, NULL it, perform again.
tests/data/test1649 Expected protocol output: first request has Referer, second has none.
tests/libtest/Makefile.inc Add lib1649.c to TESTS_C.
tests/data/Makefile.am Register test1649.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder closed this in 862e8a7 May 26, 2026
@bagder bagder deleted the bagder/referer branch May 26, 2026 08:05
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants