mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-27 17:22:57 +01:00
update readme
This commit is contained in:
parent
53868a88fa
commit
f23974cfb5
13
README.md
13
README.md
@ -13,7 +13,7 @@ Actix web is licensed under the [Apache-2.0 license](http://opensource.org/licen
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* HTTP/1 and HTTP/2
|
* Supported HTTP/1 and HTTP/2 protocols
|
||||||
* Streaming and pipelining
|
* Streaming and pipelining
|
||||||
* Keep-alive and slow requests handling
|
* Keep-alive and slow requests handling
|
||||||
* [WebSockets](https://actix.github.io/actix-web/actix_web/ws/index.html)
|
* [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
|
## HTTP/2
|
||||||
|
|
||||||
### Usage
|
|
||||||
|
|
||||||
Actix web automatically upgrades connection to `http/2` if possible.
|
Actix web automatically upgrades connection to `http/2` if possible.
|
||||||
|
|
||||||
### Negotiation
|
### 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
|
[tls alpn](https://tools.ietf.org/html/rfc7301). At the moment only
|
||||||
rust-openssl supports alpn.
|
`rust-openssl` supports alpn.
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = { git = "https://github.com/actix/actix-web", features=["alpn"] }
|
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
|
## Example
|
||||||
|
|
||||||
* [Basic](https://github.com/actix/actix-web/tree/master/examples/basic.rs)
|
* [Basic](https://github.com/actix/actix-web/tree/master/examples/basic.rs)
|
||||||
|
@ -72,7 +72,7 @@ impl<T, A, H> Future for HttpChannel<T, A, H>
|
|||||||
match h1.poll() {
|
match h1.poll() {
|
||||||
Ok(Async::Ready(h1::Http1Result::Done)) =>
|
Ok(Async::Ready(h1::Http1Result::Done)) =>
|
||||||
return Ok(Async::Ready(())),
|
return Ok(Async::Ready(())),
|
||||||
Ok(Async::Ready(h1::Http1Result::Upgrade)) => (),
|
Ok(Async::Ready(h1::Http1Result::Switch)) => (),
|
||||||
Ok(Async::NotReady) =>
|
Ok(Async::NotReady) =>
|
||||||
return Ok(Async::NotReady),
|
return Ok(Async::NotReady),
|
||||||
Err(_) =>
|
Err(_) =>
|
||||||
|
@ -31,7 +31,7 @@ const HTTP2_PREFACE: [u8; 14] = *b"PRI * HTTP/2.0";
|
|||||||
|
|
||||||
pub(crate) enum Http1Result {
|
pub(crate) enum Http1Result {
|
||||||
Done,
|
Done,
|
||||||
Upgrade,
|
Switch,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct Http1<T: AsyncWrite + 'static, A: 'static, H: 'static> {
|
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
|
// no keep-alive
|
||||||
if !self.keepalive && self.tasks.is_empty() {
|
if !self.keepalive && self.tasks.is_empty() {
|
||||||
if self.h2 {
|
if self.h2 {
|
||||||
return Ok(Async::Ready(Http1Result::Upgrade))
|
return Ok(Async::Ready(Http1Result::Switch))
|
||||||
} else {
|
} else {
|
||||||
return Ok(Async::Ready(Http1Result::Done))
|
return Ok(Async::Ready(Http1Result::Done))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user