From 07cf414e176b68c947a523b9a004467f1f094bb0 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 28 Nov 2014 18:03:37 -0800 Subject: [PATCH] fix(logging): adjust several logging messages Closes #148 --- examples/hello.rs | 1 + examples/server.rs | 1 + src/header/mod.rs | 4 +--- src/http.rs | 2 +- src/server/mod.rs | 7 ++++++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/hello.rs b/examples/hello.rs index 0f92d6bd..b01e1a34 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -13,4 +13,5 @@ fn hello(_: Request, res: Response) { fn main() { hyper::Server::http(Ipv4Addr(127, 0, 0, 1), 3000).listen(hello).unwrap(); + println!("Listening on http://127.0.0.1:3000"); } diff --git a/examples/server.rs b/examples/server.rs index 3bcbfd6e..2ae3f57b 100644 --- a/examples/server.rs +++ b/examples/server.rs @@ -52,4 +52,5 @@ fn echo(mut req: Request, mut res: Response) { fn main() { let server = Server::http(Ipv4Addr(127, 0, 0, 1), 1337); server.listen(echo).unwrap(); + println!("Listening on http://127.0.0.1:1337"); } diff --git a/src/header/mod.rs b/src/header/mod.rs index cf6e9c83..5ef772a6 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -114,7 +114,7 @@ impl Headers { loop { match try!(http::read_header(rdr)) { Some((name, value)) => { - debug!("raw header: {}={}", name, value); + debug!("raw header: {}={}", name, value[].to_ascii()); let name = CaseInsensitive(Owned(name)); let item = match headers.data.entry(name) { Vacant(entry) => entry.set(RWLock::new(Item::raw(vec![]))), @@ -389,7 +389,6 @@ fn get_or_parse(item: &RWLock) -> Option<&RWLock } fn downcast(read: &Item) -> &H { - debug!("downcasting {}", *read); match read.typed { Some(ref val) => unsafe { val.downcast_ref_unchecked() }, _ => unreachable!() @@ -397,7 +396,6 @@ fn downcast(read: &Item) -> &H { } fn downcast_mut(write: &mut Item) -> &mut H { - debug!("downcasting {}", *write); match write.typed { Some(ref mut val) => unsafe { val.downcast_mut_unchecked() }, _ => unreachable!() diff --git a/src/http.rs b/src/http.rs index 1a255927..4054f135 100644 --- a/src/http.rs +++ b/src/http.rs @@ -522,7 +522,7 @@ pub fn read_header(stream: &mut R) -> HttpResult Ok(Some((name, value))), diff --git a/src/server/mod.rs b/src/server/mod.rs index 76439834..7058e0fb 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -11,6 +11,7 @@ pub use self::response::Response; pub use net::{Fresh, Streaming}; +use HttpError::HttpIoError; use {HttpResult}; use header::common::Connection; use header::common::connection::{KeepAlive, Close}; @@ -92,9 +93,13 @@ impl, S: NetworkStream, A: NetworkAcceptor> Server req, + Err(e@HttpIoError(_)) => { + debug!("ioerror in keepalive loop = {}", e); + return; + } Err(e) => { //TODO: send a 400 response - error!("request error: {}", e); + error!("request error = {}", e); return; } };