| 1 |
# H2 |
| 2 |
|
| 3 |
A Tokio aware, HTTP/2 client & server implementation for Rust. |
| 4 |
|
| 5 |
[](https://opensource.org/licenses/MIT) |
| 6 |
[](https://crates.io/crates/h2) |
| 7 |
[][dox] |
| 8 |
|
| 9 |
More information about this crate can be found in the [crate documentation][dox]. |
| 10 |
|
| 11 |
[dox]: https://docs.rs/h2 |
| 12 |
|
| 13 |
## Features |
| 14 |
|
| 15 |
* Client and server HTTP/2 implementation. |
| 16 |
* Implements the full HTTP/2 specification. |
| 17 |
* Passes [h2spec](https://github.com/summerwind/h2spec). |
| 18 |
* Focus on performance and correctness. |
| 19 |
* Built on [Tokio](https://tokio.rs). |
| 20 |
|
| 21 |
## Non goals |
| 22 |
|
| 23 |
This crate is intended to only be an implementation of the HTTP/2 |
| 24 |
specification. It does not handle: |
| 25 |
|
| 26 |
* Managing TCP connections |
| 27 |
* HTTP 1.0 upgrade |
| 28 |
* TLS |
| 29 |
* Any feature not described by the HTTP/2 specification. |
| 30 |
|
| 31 |
This crate is now used by [hyper](https://github.com/hyperium/hyper), which will provide all of these features. |
| 32 |
|
| 33 |
## Usage |
| 34 |
|
| 35 |
To use `h2`, first add this to your `Cargo.toml`: |
| 36 |
|
| 37 |
```toml |
| 38 |
[dependencies] |
| 39 |
h2 = "0.3" |
| 40 |
``` |
| 41 |
|
| 42 |
Next, add this to your crate: |
| 43 |
|
| 44 |
```rust |
| 45 |
extern crate h2; |
| 46 |
|
| 47 |
use h2::server::Connection; |
| 48 |
|
| 49 |
fn main() { |
| 50 |
// ... |
| 51 |
} |
| 52 |
``` |
| 53 |
|
| 54 |
## FAQ |
| 55 |
|
| 56 |
**How does h2 compare to [solicit] or [rust-http2]?** |
| 57 |
|
| 58 |
The h2 library has implemented more of the details of the HTTP/2 specification |
| 59 |
than any other Rust library. It also passes the [h2spec] set of tests. The h2 |
| 60 |
library is rapidly approaching "production ready" quality. |
| 61 |
|
| 62 |
Besides the above, Solicit is built on blocking I/O and does not appear to be |
| 63 |
actively maintained. |
| 64 |
|
| 65 |
**Is this an embedded Java SQL database engine?** |
| 66 |
|
| 67 |
[No](https://www.h2database.com). |
| 68 |
|
| 69 |
[solicit]: https://github.com/mlalic/solicit |
| 70 |
[rust-http2]: https://github.com/stepancheg/rust-http2 |
| 71 |
[h2spec]: https://github.com/summerwind/h2spec |