1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-29 18:40:51 +00:00

update readme

This commit is contained in:
Nikolay Kim 2017-11-04 13:49:05 -07:00
parent 53868a88fa
commit f23974cfb5
3 changed files with 11 additions and 8 deletions

View file

@ -13,7 +13,7 @@ Actix web is licensed under the [Apache-2.0 license](http://opensource.org/licen
## Features
* HTTP/1 and HTTP/2
* Supported HTTP/1 and HTTP/2 protocols
* Streaming and pipelining
* Keep-alive and slow requests handling
* [WebSockets](https://actix.github.io/actix-web/actix_web/ws/index.html)
@ -32,21 +32,24 @@ actix-web = { git = "https://github.com/actix/actix-web" }
## HTTP/2
### Usage
Actix web automatically upgrades connection to `http/2` if possible.
### Negotiation
To use http/2 protocol over tls without prior knowlage requires
To use `http/2` protocol over tls without prior knowlage requires
[tls alpn](https://tools.ietf.org/html/rfc7301). At the moment only
rust-openssl supports alpn.
`rust-openssl` supports alpn.
```toml
[dependencies]
actix-web = { git = "https://github.com/actix/actix-web", features=["alpn"] }
```
Upgrade to `http/2` schema described in
[rfc section3.2](https://http2.github.io/http2-spec/#rfc.section.3.2) is not supported.
Starting `http/2` with prior knowledge is supported for both clear text connection
and tls connection. [rfc link](https://http2.github.io/http2-spec/#rfc.section.3.4)
## Example
* [Basic](https://github.com/actix/actix-web/tree/master/examples/basic.rs)

View file

@ -72,7 +72,7 @@ impl<T, A, H> Future for HttpChannel<T, A, H>
match h1.poll() {
Ok(Async::Ready(h1::Http1Result::Done)) =>
return Ok(Async::Ready(())),
Ok(Async::Ready(h1::Http1Result::Upgrade)) => (),
Ok(Async::Ready(h1::Http1Result::Switch)) => (),
Ok(Async::NotReady) =>
return Ok(Async::NotReady),
Err(_) =>

View file

@ -31,7 +31,7 @@ const HTTP2_PREFACE: [u8; 14] = *b"PRI * HTTP/2.0";
pub(crate) enum Http1Result {
Done,
Upgrade,
Switch,
}
pub(crate) struct Http1<T: AsyncWrite + 'static, A: 'static, H: 'static> {
@ -157,7 +157,7 @@ impl<T, A, H> Http1<T, A, H>
// no keep-alive
if !self.keepalive && self.tasks.is_empty() {
if self.h2 {
return Ok(Async::Ready(Http1Result::Upgrade))
return Ok(Async::Ready(Http1Result::Switch))
} else {
return Ok(Async::Ready(Http1Result::Done))
}