transfer: clear referer when set to NULL#21741
Closed
bagder wants to merge 1 commit into
Closed
Conversation
Verify in test 1649
There was a problem hiding this comment.
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, cleardata->state.refererviaCurl_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.amandtests/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.
outcast36
pushed a commit
to greearb/curl
that referenced
this pull request
Jun 3, 2026
Verify in test 1649 Closes curl#21741
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.
Verify in test 1649