Merge pull request #360 from doylemark/master

Return correct protocol error when missing http version
master
Daniel Abramov 2 years ago committed by GitHub
commit 57d9e23939
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/handshake/client.rs

@ -258,7 +258,7 @@ impl TryParse for Response {
impl<'h, 'b: 'h> FromHttparse<httparse::Response<'h, 'b>> for Response { impl<'h, 'b: 'h> FromHttparse<httparse::Response<'h, 'b>> for Response {
fn from_httparse(raw: httparse::Response<'h, 'b>) -> Result<Self> { fn from_httparse(raw: httparse::Response<'h, 'b>) -> Result<Self> {
if raw.version.expect("Bug: no HTTP version") < /*1.*/1 { if raw.version.expect("Bug: no HTTP version") < /*1.*/1 {
return Err(Error::Protocol(ProtocolError::WrongHttpMethod)); return Err(Error::Protocol(ProtocolError::WrongHttpVersion));
} }
let headers = HeaderMap::from_httparse(raw.headers)?; let headers = HeaderMap::from_httparse(raw.headers)?;

Loading…
Cancel
Save