diff --git a/src/http.rs b/src/http.rs index fe884b263f..710682785d 100644 --- a/src/http.rs +++ b/src/http.rs @@ -59,6 +59,16 @@ impl HttpReader { EmptyReader(r) => r, } } + + /// Gets a mutable reference to the underlying Reader. + pub fn get_mut(&mut self) -> &mut R { + match *self { + SizedReader(ref mut r, _) => r, + ChunkedReader(ref mut r, _) => r, + EofReader(ref mut r) => r, + EmptyReader(ref mut r) => r, + } + } } impl fmt::Debug for HttpReader { @@ -121,7 +131,9 @@ impl Read for HttpReader { Ok(count as usize) }, EofReader(ref mut body) => { - body.read(buf) + let r = body.read(buf); + trace!("eofread: {:?}", r); + r }, EmptyReader(_) => Ok(0) }