perf(http): changes http parsing to use httparse crate
httparse is a http1 stateless push parser. This not only speeds up parsing right now with sync io, but will also be useful for when we get async io, since it's push based instead of pull. BREAKING CHANGE: Several public functions and types in the `http` module have been removed. They have been replaced with 2 methods that handle all of the http1 parsing.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#![deny(warnings)]
|
||||
#![feature(io, net)]
|
||||
extern crate hyper;
|
||||
extern crate env_logger;
|
||||
|
||||
use std::io::Write;
|
||||
use std::net::IpAddr;
|
||||
@@ -15,6 +16,7 @@ fn hello(_: Request, res: Response) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
env_logger::init().unwrap();
|
||||
let _listening = hyper::Server::http(hello)
|
||||
.listen(IpAddr::new_v4(127, 0, 0, 1), 3000).unwrap();
|
||||
println!("Listening on http://127.0.0.1:3000");
|
||||
|
||||
Reference in New Issue
Block a user