summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2021-02-16 10:19:37 +0000
committerViktor Szakats <commit@vsz.me>2021-02-16 10:19:37 +0000
commitcdb630655db39ff1a319ace871e75389072deeb9 (patch)
tree3aac7513087053d8e8ada6053b6cfd98f465197b /src
parentcfff12a0b3d8696e5923064ea4e35e14a4f78da0 (diff)
downloadcurl-cdb630655db39ff1a319ace871e75389072deeb9.tar.gz
http: do not add a referrer header with empty value
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. Reviewed-by: Jay Satiro Closes #6610
Diffstat (limited to 'src')
-rw-r--r--src/tool_getparam.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index d337251f9..5b155cf00 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -1547,7 +1547,8 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
}
else
config->autoreferer = FALSE;
- GetStr(&config->referer, nextarg);
+ ptr = *nextarg ? nextarg : NULL;
+ GetStr(&config->referer, ptr);
}
break;
case 'E':