This commit is contained in:
Martin Algesten
2018-07-01 10:19:40 +02:00
parent ca533bc518
commit 03928a05c5
3 changed files with 8 additions and 7 deletions

View File

@@ -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<Read>,
)) as Box<dyn Read>,
(false, Some(len)) => Box::new(PoolReturnRead::new(
unit,
stream_ptr,
@@ -499,6 +499,7 @@ fn read_next_line<R: Read>(reader: &mut R) -> IoResult<AsciiString> {
}
}
/// Read Wrapper around an (unsafe) pointer to a Stream.
struct YoloRead {
stream: *mut Stream,
}