rust upgrade

This commit is contained in:
Sean McArthur
2014-12-02 13:12:04 -08:00
parent 1ed4ea5a27
commit fec030a21e
7 changed files with 19 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ use std::io::net::ip::Ipv4Addr;
use hyper::{Get, Post};
use hyper::header::common::ContentLength;
use hyper::server::{Server, Request, Response};
use hyper::uri::RequestUri::AbsolutePath;
macro_rules! try_return(
($e:expr) => {{
@@ -21,7 +22,7 @@ macro_rules! try_return(
fn echo(mut req: Request, mut res: Response) {
match req.uri {
hyper::uri::AbsolutePath(ref path) => match (&req.method, path.as_slice()) {
AbsolutePath(ref path) => match (&req.method, path.as_slice()) {
(&Get, "/") | (&Get, "/echo") => {
let out = b"Try POST /echo";
@@ -33,7 +34,7 @@ fn echo(mut req: Request, mut res: Response) {
},
(&Post, "/echo") => (), // fall through, fighting mutable borrows
_ => {
*res.status_mut() = hyper::status::NotFound;
*res.status_mut() = hyper::NotFound;
try_return!(res.start().and_then(|res| res.end()));
return;
}