This commit is contained in:
Sean McArthur
2014-09-06 14:45:29 -07:00
parent 1926e82369
commit eaa3cb46ee
4 changed files with 10 additions and 5 deletions

View File

@@ -5,7 +5,6 @@ extern crate hyper;
extern crate test;
use std::fmt::{mod, Show};
use std::str::{SendStr, Slice};
use std::io::IoResult;
use std::io::net::ip::Ipv4Addr;
use hyper::server::{Request, Response, Server};

View File

@@ -28,6 +28,12 @@ macro_rules! try_io(
($e:expr) => (match $e { Ok(v) => v, Err(e) => return Err(::HttpIoError(e)) })
)
macro_rules! todo(
($($arg:tt)*) => (if cfg!(not(ndebug)) {
format_args!(|args| log!(5, "TODO: {}", args), $($arg)*)
})
)
#[allow(dead_code)]
struct Trace;

View File

@@ -108,7 +108,7 @@ fn read_chunk_size<R: Reader>(rdr: &mut R) -> IoResult<uint> {
},
ext => {
in_ext = true;
debug!("TODO: chunk extension byte={}", ext);
todo!("chunk extension byte={}", ext);
}
}
}
@@ -376,7 +376,7 @@ pub fn read_uri<R: Reader>(stream: &mut R) -> HttpResult<uri::RequestUri> {
temp.push_str(s.as_slice());
match Url::parse(temp.as_slice()) {
Ok(_u) => {
debug!("TODO: compare vs u.authority()");
todo!("compare vs u.authority()");
Ok(uri::Authority(s))
}
Err(_e) => {
@@ -467,7 +467,7 @@ pub fn read_header<R: Reader>(stream: &mut R) -> HttpResult<Option<RawHeaderLine
let mut ows = true; //optional whitespace
//TODO: handling obs-folding (gross!)
todo!("handle obs-folding (gross!)");
loop {
match try_io!(stream.read_byte()) {
CR => break,

View File

@@ -44,13 +44,13 @@ impl Request {
debug!("{}", headers);
// TODO: handle Transfer-Encoding
let body = if headers.has::<ContentLength>() {
match headers.get_ref::<ContentLength>() {
Some(&ContentLength(len)) => SizedReader(tcp, len),
None => unreachable!()
}
} else {
todo!("check for Transfer-Encoding: chunked");
ChunkedReader(tcp, None)
};