mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
Merge pull request #1399 from JohnTitor/new-http
Release actix-http 2.0.0-alpha.2
This commit is contained in:
commit
5da9e277a2
@ -71,7 +71,7 @@ actix-threadpool = "0.3.1"
|
||||
actix-tls = "2.0.0-alpha.1"
|
||||
|
||||
actix-web-codegen = "0.2.0"
|
||||
actix-http = "2.0.0-alpha.1"
|
||||
actix-http = "2.0.0-alpha.2"
|
||||
awc = { version = "1.0.1", default-features = false }
|
||||
|
||||
bytes = "0.5.3"
|
||||
|
@ -19,7 +19,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
actix-web = { version = "2.0.0-rc", default-features = false }
|
||||
actix-http = "2.0.0-alpha.1"
|
||||
actix-http = "2.0.0-alpha.2"
|
||||
actix-service = "1.0.1"
|
||||
bitflags = "1"
|
||||
bytes = "0.5.3"
|
||||
|
@ -23,7 +23,7 @@ actix-codec = "0.2.0"
|
||||
actix-service = "1.0.1"
|
||||
actix-router = "0.2.1"
|
||||
actix-rt = "1.0.0"
|
||||
actix-http = "2.0.0-alpha.1"
|
||||
actix-http = "2.0.0-alpha.2"
|
||||
|
||||
bytes = "0.5.3"
|
||||
futures = "0.3.1"
|
||||
|
@ -1,16 +1,20 @@
|
||||
# Changes
|
||||
|
||||
## [2.0.0-alpha.2] - someday
|
||||
## [2.0.0-alpha.2] - 2020-03-07
|
||||
|
||||
### Changed
|
||||
|
||||
* Update `actix-connect` and `actix-tls` dependency to 2.0.0-alpha.1
|
||||
* Update `actix-connect` and `actix-tls` dependency to 2.0.0-alpha.1. [#1395]
|
||||
|
||||
* Change default initial window size and connection window size for HTTP2 to 2MB and 1MB respectively to improve download speed for awc when downloading large objects.
|
||||
* Change default initial window size and connection window size for HTTP2 to 2MB and 1MB respectively
|
||||
to improve download speed for awc when downloading large objects. [#1394]
|
||||
|
||||
* client::Connector accepts initial_window_size and initial_connection_window_size HTTP2 configuration
|
||||
* client::Connector accepts initial_window_size and initial_connection_window_size HTTP2 configuration. [#1394]
|
||||
|
||||
* client::Connector allowing to set max_http_version to limit HTTP version to be used
|
||||
* client::Connector allowing to set max_http_version to limit HTTP version to be used. [#1394]
|
||||
|
||||
[#1394]: https://github.com/actix/actix-web/pull/1394
|
||||
[#1395]: https://github.com/actix/actix-web/pull/1395
|
||||
|
||||
## [2.0.0-alpha.1] - 2020-02-27
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "actix-http"
|
||||
version = "2.0.0-alpha.1"
|
||||
version = "2.0.0-alpha.2"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix http primitives"
|
||||
readme = "README.md"
|
||||
|
@ -14,19 +14,34 @@ Actix http
|
||||
|
||||
```rust
|
||||
// see examples/framed_hello.rs for complete list of used crates.
|
||||
extern crate actix_http;
|
||||
use actix_http::{h1, Response, ServiceConfig};
|
||||
use std::{env, io};
|
||||
|
||||
fn main() {
|
||||
Server::new().bind("framed_hello", "127.0.0.1:8080", || {
|
||||
IntoFramed::new(|| h1::Codec::new(ServiceConfig::default())) // <- create h1 codec
|
||||
.and_then(TakeItem::new().map_err(|_| ())) // <- read one request
|
||||
.and_then(|(_req, _framed): (_, Framed<_, _>)| { // <- send response and close conn
|
||||
SendResponse::send(_framed, Response::Ok().body("Hello world!"))
|
||||
.map_err(|_| ())
|
||||
.map(|_| ())
|
||||
})
|
||||
}).unwrap().run();
|
||||
use actix_http::{HttpService, Response};
|
||||
use actix_server::Server;
|
||||
use futures::future;
|
||||
use http::header::HeaderValue;
|
||||
use log::info;
|
||||
|
||||
#[actix_rt::main]
|
||||
async fn main() -> io::Result<()> {
|
||||
env::set_var("RUST_LOG", "hello_world=info");
|
||||
env_logger::init();
|
||||
|
||||
Server::build()
|
||||
.bind("hello-world", "127.0.0.1:8080", || {
|
||||
HttpService::build()
|
||||
.client_timeout(1000)
|
||||
.client_disconnect(1000)
|
||||
.finish(|_req| {
|
||||
info!("{:?}", _req);
|
||||
let mut res = Response::Ok();
|
||||
res.header("x-head", HeaderValue::from_static("dummy value!"));
|
||||
future::ok::<_, ()>(res.body("Hello world!"))
|
||||
})
|
||||
.tcp()
|
||||
})?
|
||||
.run()
|
||||
.await
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -78,8 +78,7 @@ impl Connector<(), ()> {
|
||||
|
||||
// Build Ssl connector with openssl, based on supplied alpn protocols
|
||||
#[cfg(feature = "openssl")]
|
||||
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector
|
||||
{
|
||||
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector {
|
||||
use actix_connect::ssl::openssl::SslMethod;
|
||||
use bytes::{BufMut, BytesMut};
|
||||
|
||||
@ -98,8 +97,7 @@ impl Connector<(), ()> {
|
||||
|
||||
// Build Ssl connector with rustls, based on supplied alpn protocols
|
||||
#[cfg(all(not(feature = "openssl"), feature = "rustls"))]
|
||||
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector
|
||||
{
|
||||
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector {
|
||||
let mut config = ClientConfig::new();
|
||||
config.set_protocols(&protocols);
|
||||
config
|
||||
@ -169,7 +167,9 @@ where
|
||||
let versions = match val {
|
||||
http::Version::HTTP_11 => vec![b"http/1.1".to_vec()],
|
||||
http::Version::HTTP_2 => vec![b"h2".to_vec(), b"http/1.1".to_vec()],
|
||||
_ => unimplemented!("actix-http:client: supported versions http/1.1, http/2"),
|
||||
_ => {
|
||||
unimplemented!("actix-http:client: supported versions http/1.1, http/2")
|
||||
}
|
||||
};
|
||||
self.ssl = Connector::build_ssl(versions);
|
||||
self
|
||||
|
@ -395,7 +395,8 @@ where
|
||||
Poll::Ready(Ok(req)) => {
|
||||
self.as_mut().send_continue();
|
||||
this = self.as_mut().project();
|
||||
this.state.set(State::ServiceCall(Box::pin(this.service.call(req))));
|
||||
this.state
|
||||
.set(State::ServiceCall(Box::pin(this.service.call(req))));
|
||||
continue;
|
||||
}
|
||||
Poll::Ready(Err(e)) => {
|
||||
|
@ -29,4 +29,4 @@ twoway = "0.2"
|
||||
|
||||
[dev-dependencies]
|
||||
actix-rt = "1.0.0"
|
||||
actix-http = "2.0.0-alpha.1"
|
||||
actix-http = "2.0.0-alpha.2"
|
||||
|
@ -18,7 +18,7 @@ path = "src/lib.rs"
|
||||
[dependencies]
|
||||
actix = "0.10.0-alpha.1"
|
||||
actix-web = "2.0.0"
|
||||
actix-http = "2.0.0-alpha.1"
|
||||
actix-http = "2.0.0-alpha.2"
|
||||
actix-codec = "0.2.0"
|
||||
bytes = "0.5.2"
|
||||
futures = "0.3.1"
|
||||
|
@ -36,7 +36,7 @@ compress = ["actix-http/compress"]
|
||||
[dependencies]
|
||||
actix-codec = "0.2.0"
|
||||
actix-service = "1.0.1"
|
||||
actix-http = "2.0.0-alpha.1"
|
||||
actix-http = "2.0.0-alpha.2"
|
||||
actix-rt = "1.0.0"
|
||||
|
||||
base64 = "0.11"
|
||||
@ -56,7 +56,7 @@ rust-tls = { version = "0.17.0", package="rustls", optional = true, features = [
|
||||
[dev-dependencies]
|
||||
actix-connect = { version = "2.0.0-alpha.1", features=["openssl"] }
|
||||
actix-web = { version = "2.0.0", features=["openssl"] }
|
||||
actix-http = { version = "2.0.0-alpha.1", features=["openssl"] }
|
||||
actix-http = { version = "2.0.0-alpha.2", features=["openssl"] }
|
||||
actix-http-test = { version = "1.0.0", features=["openssl"] }
|
||||
actix-utils = "1.0.3"
|
||||
actix-server = "1.0.0"
|
||||
|
@ -56,4 +56,4 @@ open-ssl = { version="0.10", package="openssl", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
actix-web = "2.0.0"
|
||||
actix-http = "2.0.0-alpha.1"
|
||||
actix-http = "2.0.0-alpha.2"
|
||||
|
Loading…
Reference in New Issue
Block a user