Commit 3bf38ded authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Reject URLs containing white spaces

Refs #1862
parent d63efb1a
......@@ -382,6 +382,8 @@ htc_proto_ver(struct http *hp)
hp->protover = 10;
else if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1"))
hp->protover = 11;
else if (*hp->hd[HTTP_HDR_PROTO].b != '\0')
hp->protover = 0;
else
hp->protover = 9;
}
......@@ -410,6 +412,10 @@ HTTP1_DissectRequest(struct req *req)
return (retval);
}
htc_proto_ver(hp);
if (hp->protover == 0) {
VSLb(hp->vsl, SLT_Error, "Illegal URL or protocol");
return (400);
}
if (http_CountHdr(hp, H_Host) > 1) {
VSLb(hp->vsl, SLT_Error, "Duplicate Host header");
......
varnishtest "Whitespace in the request URL"
server s1 "" -start
varnish v1 -vcl+backend "" -start
client c1 {
txreq -url "/foo bar"
rxresp
expect resp.status == 400
} -run
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