feat(server): change Incoming to iterator over Connections
A connection is returned from Incoming.next(), and can be passed to a separate thread before any parsing happens. Call conn.open() to get a Result<(Request, Response)>. BREAKING CHANGE
This commit is contained in:
@@ -18,7 +18,8 @@ fn request(url: hyper::Url) {
|
||||
}
|
||||
|
||||
fn hyper_handle(mut incoming: hyper::server::Incoming) {
|
||||
for (_, mut res) in incoming {
|
||||
for conn in incoming {
|
||||
let (_, res) = conn.open().unwrap();
|
||||
let mut res = res.start().unwrap();
|
||||
res.write(PHRASE).unwrap();
|
||||
res.end().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user