Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from rawler/code-cleanup
Code cleanup
- Loading branch information
Showing
23 changed files
with
856 additions
and
559 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
extern crate tiny_http; | ||
|
||
fn main() { | ||
use tiny_http::{Server, Response}; | ||
use tiny_http::{Response, Server}; | ||
|
||
let server = Server::http("0.0.0.0:8000").unwrap(); | ||
|
||
for request in server.incoming_requests() { | ||
println!("received request! method: {:?}, url: {:?}, headers: {:?}", | ||
println!( | ||
"received request! method: {:?}, url: {:?}, headers: {:?}", | ||
request.method(), | ||
request.url(), | ||
request.headers() | ||
); | ||
|
||
let response = Response::from_string("hello world"); | ||
request.respond(response); | ||
request.respond(response).expect("Responded"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.