Commit d8810a87 authored by Federico G. Schwindt's avatar Federico G. Schwindt Committed by Pål Hermunn Johansen

Whitespace after colon is optional

Fixes #2148.
parent debcb99d
......@@ -803,12 +803,12 @@ static int
isprefix(const char *str, const char *prefix, const char *end,
const char **next)
{
size_t len;
while (str < end && *str && *prefix &&
tolower((int)*str) == tolower((int)*prefix))
++str, ++prefix;
if (*str && *str != ' ')
len = strlen(prefix);
if (end - str < len || strncasecmp(str, prefix, len))
return (0);
str += len;
if (next) {
while (str < end && *str && *str == ' ')
++str;
......@@ -1010,7 +1010,7 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[],
if (isprefix(b, "Host:", e, &p))
frag_line(0, p, e, &CTX.frag[F_host]);
else if (isprefix(b, "Authorization:", e, &p) &&
isprefix(p, "basic", e, &p))
isprefix(p, "basic ", e, &p))
frag_line(0, p, e, &CTX.frag[F_auth]);
break;
case (SLT_VCL_call + BACKEND_MARKER):
......
varnishtest "Whitespace after colon is optional"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {} -start
client c1 {
txreq -hdr "Host:qux" -hdr "Authorization:Basic Zm9vOmJhcg=="
rxresp
} -run
process p1 {varnishncsa -d -n ${v1_name} -F "%u %{Host}i"} -run
shell {grep -q "foo qux" ${tmpdir}/p1/stdout}
process p2 {varnishncsa -d -n ${v1_name} -F "%r"} -run
shell {grep -q "GET http://qux/ HTTP/1.1" ${tmpdir}/p2/stdout}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment