From b9bfdd05372509a114eb151267cf2af6255fe5e8 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Mon, 10 Nov 2014 20:53:37 -0800 Subject: [PATCH] style changes --- src/http.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/http.rs b/src/http.rs index d1cc7634..40311de7 100644 --- a/src/http.rs +++ b/src/http.rs @@ -296,22 +296,22 @@ pub fn is_token(b: u8) -> bool { /// otherwise returns any error encountered reading the stream. /// /// The remaining contents of `buf` are left untouched. -fn read_until_space(stream: &mut R, buf: &mut [u8]) -> HttpResult { +fn read_until_space(stream: &mut R, buf: &mut [u8]) -> HttpResult { use std::io::BufWriter; let mut bufwrt = BufWriter::new(buf); loop { let byte = try_io!(stream.read_byte()); - + if byte == SP { break // Read to end but there's still more } else if bufwrt.write_u8(byte).is_err() { return Ok(false) - } + } } - - Ok(true) + + Ok(true) } /// Read a `Method` from a raw stream, such as `GET`. @@ -320,7 +320,7 @@ fn read_until_space(stream: &mut R, buf: &mut [u8]) -> HttpResult(stream: &mut R) -> HttpResult { let mut buf = [SP, ..16]; - if !try!(read_until_space(stream, &mut buf)){ + if !try!(read_until_space(stream, &mut buf)) { return Err(HttpMethodError); } @@ -520,6 +520,7 @@ pub type RequestLine = (method::Method, uri::RequestUri, HttpVersion); /// Read the `RequestLine`, such as `GET / HTTP/1.1`. pub fn read_request_line(stream: &mut R) -> HttpResult { + debug!("read request line"); let method = try!(read_method(stream)); debug!("method = {}", method); let uri = try!(read_uri(stream));