-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some performance improvements, improving public API, and updaing
the README
- Loading branch information
Showing
5 changed files
with
38 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
# Htpp | ||
|
||
An **fast** and simple HTTP 1.1 parser written in Rust | ||
|
||
# Contribution | ||
|
||
Feel free to make a pull request if you think you can improve the code | ||
A **fast** and simple HTTP 1.1 parser written in Rust | ||
|
||
# Usage | ||
|
||
To parse an HTTP request: | ||
|
||
```rust | ||
let req = b"GET /index.html HTTP/1.1\r\n"; | ||
let req = b"GET /index.html HTTP/1.1\r\n\r\n"; | ||
let parsed_req = htpp::RequestParser::new(req).parse().unwrap(); | ||
assert(parsed_req.method() == htpp::Method::Get); | ||
assert(parsed_req.path() == "/index.html"); | ||
assert!(parsed_req.method() == htpp::Method::Get); | ||
assert!(parsed_req.path() == "/index.html"); | ||
``` | ||
|
||
To parse an HTTP response: | ||
|
||
```rust | ||
let resp = b"HTTP/1.1 200 OK\r\n\r\n"; | ||
let parsed_resp = htpp::ResponseParser::new(resp).parse().unwrap(); | ||
assert(parsed_resp.status() == 200); | ||
assert(parsed_resp.reason() == "OK"); | ||
assert!(parsed_resp.status() == 200); | ||
assert!(parsed_resp.reason() == "OK"); | ||
``` | ||
|
||
# Contribution | ||
|
||
Feel free to make a pull request if you think you can improve the code | ||
|
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