feat(server): add server::Serve that can use a shared Handle

- Adds `Http::serve_addr_handle` which will bind to an address with a
  provided `Handle`, and return a `Serve`.
- Adds `server::Serve` which is a `Stream` of incoming `Connection`s
  being bound by a `NewService`.
- Renames `Http::no_proto` to `Http::serve_connection`.
This commit is contained in:
Sean McArthur
2017-10-30 14:17:43 -07:00
parent 0844dede19
commit 39cf6ef7d2
3 changed files with 346 additions and 339 deletions

View File

@@ -524,7 +524,7 @@ fn no_proto_empty_parse_eof_does_not_return_error() {
.map_err(|_| unreachable!())
.and_then(|(item, _incoming)| {
let (socket, _) = item.unwrap();
Http::new().no_proto(socket, HelloWorld)
Http::<hyper::Chunk>::new().serve_connection(socket, HelloWorld)
});
core.run(fut).unwrap();
@@ -546,7 +546,7 @@ fn no_proto_nonempty_parse_eof_returns_error() {
.map_err(|_| unreachable!())
.and_then(|(item, _incoming)| {
let (socket, _) = item.unwrap();
Http::new().no_proto(socket, HelloWorld)
Http::<hyper::Chunk>::new().serve_connection(socket, HelloWorld)
.map(|_| ())
});