gdritter repos httputils / 5095e2e
Simplified interface Getty Ritter 9 years ago
2 changed file(s) with 4 addition(s) and 4 deletion(s). Collapse all Expand all
1313 Ok(mut f) => {
1414 let mut s = String::new();
1515 match f.read_to_string(&mut s) {
16 Ok(_) => callback(s),
16 Ok(_) => callback(s.trim().to_string()),
1717 Err(_) => default,
1818 }
1919 },
106106 |s| s);
107107 let port = with_file(&dir.join("port"),
108108 Ok(80),
109 |s| s.trim().parse::<u32>() );
109 |s| s.parse::<u32>() );
110110 let port_num = match port {
111111 Ok(n) => n,
112112 Err(e) => return aloys_error(format!("Bad port number in `{:?}: {:?}`", dir, e)),
134134 impl Delegate {
135135 fn run(&self, req: &Request, res: Response<Fresh>) {
136136 match self {
137 &Delegate::Forward(_) => {
138 let _ = res.send(b"[matched by me!]");
137 &Delegate::Forward(ref fwd) => {
138 let _ = res.send(format!("[forward to {:?}:{:?}]", fwd.domn, fwd.port).as_bytes());
139139 },
140140 &Delegate::Defer(ref rts) => {
141141 rts.dispatch(req, res);