diff --git a/src/body.rs b/src/body.rs index 5d427a2..e2c6039 100644 --- a/src/body.rs +++ b/src/body.rs @@ -19,7 +19,7 @@ pub enum Payload { Text(String, String), #[cfg(feature = "json")] JSON(SerdeValue), - Reader(Box), + Reader(Box), } impl ::std::fmt::Debug for Payload { @@ -42,11 +42,11 @@ impl Default for Payload { pub struct SizedReader { pub size: Option, - pub reader: Box, + pub reader: Box, } impl SizedReader { - fn new(size: Option, reader: Box) -> Self { + fn new(size: Option, reader: Box) -> Self { SizedReader { size, reader } } } diff --git a/src/response.rs b/src/response.rs index 09109ab..af9954d 100644 --- a/src/response.rs +++ b/src/response.rs @@ -264,7 +264,7 @@ impl Response { let use_chunked = !is_http10 && !is_head && is_chunked; - let expected_bytes = if is_http10 || is_close { + let limit_bytes = if is_http10 || is_close { None } else if is_head { // head requests never have a body @@ -279,12 +279,12 @@ impl Response { let yolo = YoloRead { stream: stream_ptr }; let unit = self.unit; - match (use_chunked, expected_bytes) { + match (use_chunked, limit_bytes) { (true, _) => Box::new(PoolReturnRead::new( unit, stream_ptr, ChunkDecoder::new(yolo), - )) as Box, + )) as Box, (false, Some(len)) => Box::new(PoolReturnRead::new( unit, stream_ptr, @@ -499,6 +499,7 @@ fn read_next_line(reader: &mut R) -> IoResult { } } +/// Read Wrapper around an (unsafe) pointer to a Stream. struct YoloRead { stream: *mut Stream, } diff --git a/src/stream.rs b/src/stream.rs index ac54d30..a717e74 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -15,7 +15,7 @@ pub enum Stream { Https(TlsStream), Cursor(Cursor>), #[cfg(test)] - Test(Box, Vec), + Test(Box, Vec), } impl ::std::fmt::Debug for Stream {