fix(client): coerce HTTP_2 requests to HTTP_11

Closes #1770
This commit is contained in:
Sean McArthur
2019-02-27 16:55:39 -08:00
parent 2b0a5eaa04
commit 3a6080b14a
3 changed files with 99 additions and 14 deletions

View File

@@ -271,7 +271,7 @@ impl Http1Transaction for Server {
warn!("response with HTTP2 version coerced to HTTP/1.1");
extend(dst, b"HTTP/1.1 ");
},
_ => unreachable!(),
other => panic!("unexpected response version: {:?}", other),
}
extend(dst, msg.head.subject.as_str().as_bytes());
@@ -667,7 +667,11 @@ impl Http1Transaction for Client {
match msg.head.version {
Version::HTTP_10 => extend(dst, b"HTTP/1.0"),
Version::HTTP_11 => extend(dst, b"HTTP/1.1"),
_ => unreachable!(),
Version::HTTP_2 => {
warn!("request with HTTP2 version coerced to HTTP/1.1");
extend(dst, b"HTTP/1.1");
},
other => panic!("unexpected request version: {:?}", other),
}
extend(dst, b"\r\n");