From 16c05f07ba8ef1574e2e16e51bd1c08d933664b6 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 2 Mar 2018 20:40:08 -0800 Subject: [PATCH] make HttpRequest::match_info_mut() public --- src/client/parser.rs | 15 ++++++++------- src/httprequest.rs | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/client/parser.rs b/src/client/parser.rs index 1eeb021b..22b8f78a 100644 --- a/src/client/parser.rs +++ b/src/client/parser.rs @@ -39,10 +39,8 @@ impl HttpResponseParser { // if buf is empty parse_message will always return NotReady, let's avoid that let read = if buf.is_empty() { match utils::read_from_io(io, buf) { - Ok(Async::Ready(0)) => { - // debug!("Ignored premature client disconnection"); - return Err(HttpResponseParserError::Disconnect); - }, + Ok(Async::Ready(0)) => + return Err(HttpResponseParserError::Disconnect), Ok(Async::Ready(_)) => (), Ok(Async::NotReady) => return Ok(Async::NotReady), @@ -66,10 +64,12 @@ impl HttpResponseParser { } if read || buf.remaining_mut() == 0 { match utils::read_from_io(io, buf) { - Ok(Async::Ready(0)) => return Err(HttpResponseParserError::Disconnect), + Ok(Async::Ready(0)) => + return Err(HttpResponseParserError::Disconnect), Ok(Async::Ready(_)) => (), Ok(Async::NotReady) => return Ok(Async::NotReady), - Err(err) => return Err(HttpResponseParserError::Error(err.into())), + Err(err) => + return Err(HttpResponseParserError::Error(err.into())), } } else { return Ok(Async::NotReady) @@ -109,7 +109,8 @@ impl HttpResponseParser { } } - fn parse_message(buf: &mut BytesMut) -> Poll<(ClientResponse, Option), ParseError> + fn parse_message(buf: &mut BytesMut) + -> Poll<(ClientResponse, Option), ParseError> { // Parse http message let bytes_ptr = buf.as_ref().as_ptr() as usize; diff --git a/src/httprequest.rs b/src/httprequest.rs index ae7c21ba..688bea7a 100644 --- a/src/httprequest.rs +++ b/src/httprequest.rs @@ -365,7 +365,7 @@ impl HttpRequest { /// Get mutable reference to request's Params. #[inline] - pub(crate) fn match_info_mut(&mut self) -> &mut Params { + pub fn match_info_mut(&mut self) -> &mut Params { unsafe{ mem::transmute(&mut self.as_mut().params) } }