diff --git a/src/http.rs b/src/http.rs index b87b56ae..f17ab024 100644 --- a/src/http.rs +++ b/src/http.rs @@ -2,7 +2,7 @@ use std::cmp::min; use std::fmt; use std::io::{mod, Reader, IoResult}; -use std::u16; +use std::str; use url::Url; @@ -545,7 +545,7 @@ pub fn read_status(stream: &mut R) -> HttpResult try_io!(stream.read_byte()), ]; - let code = match u16::parse_bytes(code.as_slice(), 10) { + let code = match str::from_utf8(code.as_slice()).and_then(from_str::) { Some(num) => match FromPrimitive::from_u16(num) { Some(code) => code, None => return Err(HttpStatusError)