add bits to deal with Upgrade requests

This commit is contained in:
Sean McArthur
2014-09-24 17:31:56 -07:00
parent 68e2278339
commit 0ab52c9009
9 changed files with 314 additions and 60 deletions

View File

@@ -38,6 +38,18 @@ pub enum HttpReader<R> {
EofReader(R),
}
impl<R: Reader> HttpReader<R> {
/// Unwraps this HttpReader and returns the underlying Reader.
pub fn unwrap(self) -> R {
match self {
SizedReader(r, _) => r,
ChunkedReader(r, _) => r,
EofReader(r) => r,
}
}
}
impl<R: Reader> Reader for HttpReader<R> {
fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
match *self {