From cdb630655db39ff1a319ace871e75389072deeb9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 16 Feb 2021 10:19:37 +0000 Subject: [PATCH] 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 --- src/tool_getparam.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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':