Skip to content

http: do not add a referrer header with empty value - #6610

Closed
vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:referempty
Closed

http: do not add a referrer header with empty value#6610
vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:referempty

Conversation

@vszakats

@vszakats vszakats commented Feb 15, 2021

Copy link
Copy Markdown
Member

Previously an empty 'Referer:' header was added to the HTTP request when passing --referer ';auto' or --referer '' on the command-line. This patch makes --referer work like --header 'Referer:' and will only add the header if it has a non-zero length value.

@jay

jay commented Feb 15, 2021

Copy link
Copy Markdown
Member

Previously an empty Referer: header was added to the request when passing --referer ';auto' on the command-line.

That should not be the case but this change blocks --referer "" though I can't imagine why one would do that.

@vszakats

Copy link
Copy Markdown
Member Author

Yes, it will block passing an empty referrer header. On the receiving end a non-existing header should be equivalent to one that has an empty value. Unless I'm missing something.

This change will also make --referer work like --header does, where --header 'Referer:' will not send an empty "Referer:" header either.

Previously an empty 'Referer:' header was added to the HTTP request when
passing `--referer ';auto'` or `--referer ''` on the command-line. This
patch makes `--referer` work like `--header 'Referer:'` and will only add
the header if it has a non-zero length value.

Closes #xxxx
@vszakats vszakats changed the title referrer: do not add a header for empty values http: do not add a referrer header with empty value Feb 15, 2021
@vszakats

Copy link
Copy Markdown
Member Author

Updated to clear a previously set referrer when an empty value is passed, restoring original behaviour in this respect.

@vszakats vszakats closed this in cdb6306 Feb 16, 2021
@vszakats
vszakats deleted the referempty branch February 19, 2021 13:58
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