Commit 5f1fab09 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Now that it's clear there won't be a HTTP/1.2, and that HTTP/2.0

is an entirely different protocol, tighten up the version checks
correspondingly.

Also reject HTTP variants prior to HTTP/1.0.
parent fc41c5cf
...@@ -641,7 +641,7 @@ http_DoConnection(struct http *hp) ...@@ -641,7 +641,7 @@ http_DoConnection(struct http *hp)
enum sess_close retval; enum sess_close retval;
unsigned u, v; unsigned u, v;
if (hp->protover < 11) if (hp->protover == 10)
retval = SC_REQ_HTTP10; retval = SC_REQ_HTTP10;
else else
retval = SC_NULL; retval = SC_NULL;
......
...@@ -131,7 +131,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo) ...@@ -131,7 +131,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
req->res_mode |= RES_LEN; req->res_mode |= RES_LEN;
if (req->wantbody && !(req->res_mode & RES_LEN)) { if (req->wantbody && !(req->res_mode & RES_LEN)) {
if (req->http->protover >= 11) { if (req->http->protover == 11) {
req->res_mode |= RES_CHUNKED; req->res_mode |= RES_CHUNKED;
http_SetHeader(req->resp, "Transfer-Encoding: chunked"); http_SetHeader(req->resp, "Transfer-Encoding: chunked");
} else { } else {
......
...@@ -325,7 +325,7 @@ http1_proto_ver(struct http *hp) ...@@ -325,7 +325,7 @@ http1_proto_ver(struct http *hp)
else if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) else if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1"))
hp->protover = 11; hp->protover = 11;
else else
hp->protover = 9; hp->protover = 0;
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
...@@ -344,6 +344,8 @@ HTTP1_DissectRequest(struct http_conn *htc, struct http *hp) ...@@ -344,6 +344,8 @@ HTTP1_DissectRequest(struct http_conn *htc, struct http *hp)
if (retval != 0) if (retval != 0)
return (retval); return (retval);
http1_proto_ver(hp); http1_proto_ver(hp);
if (hp->protover == 0)
return (400);
if (http_CountHdr(hp, H_Host) > 1) if (http_CountHdr(hp, H_Host) > 1)
return (400); return (400);
...@@ -399,7 +401,7 @@ HTTP1_DissectResponse(struct http *hp, struct http_conn *htc) ...@@ -399,7 +401,7 @@ HTTP1_DissectResponse(struct http *hp, struct http_conn *htc)
if (retval == 0) { if (retval == 0) {
http1_proto_ver(hp); http1_proto_ver(hp);
if (hp->protover != 10 && hp->protover != 11) if (hp->protover == 0)
retval = 503; retval = 503;
} }
......
...@@ -36,10 +36,4 @@ client c1 { ...@@ -36,10 +36,4 @@ client c1 {
expect resp.bodylen == 67 expect resp.bodylen == 67
} -run } -run
client c1 {
txreq -url /foo/bar -proto ""
rxresp
expect resp.status == 200
expect resp.bodylen == 67
} -run
varnish v1 -expect esi_errors == 0 varnish v1 -expect esi_errors == 0
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