Apply code review fixes

This commit is contained in:
Maksym Vorobiov 2020-03-05 11:42:48 +02:00
parent cf70225216
commit 1c2f7d4e23
3 changed files with 43 additions and 35 deletions

View File

@ -1,5 +1,15 @@
# Changes
## [NEXT] - 2020-02-27
### Changed
* 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.
* client::Connector accepts initial_window_size and initial_connection_window_size HTTP2 configuration
* client::Connector allowing to set max_http_version to limit HTTP version to be used
## [2.0.0-alpha.1] - 2020-02-27
### Changed
@ -12,12 +22,6 @@
* MessageBody is not implemented for &'static [u8] anymore.
* 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.
* client::Connector accepts initial_window_size and initial_connection_window_size HTTP2 configuration
* client::Connector allowing to set max_http_version to limit HTTP version to be used
### Fixed
* Allow `SameSite=None` cookies to be sent in a response.

View File

@ -2,7 +2,7 @@ use std::time::Duration;
// These values are taken from hyper/src/proto/h2/client.rs
const DEFAULT_H2_CONN_WINDOW: u32 = 1024 * 1024 * 2; // 2mb
const DEFAULT_H2_STREAM_WINDOW: u32 = 1024 * 1024 * 1; // 1mb
const DEFAULT_H2_STREAM_WINDOW: u32 = 1024 * 1024; // 1mb
/// Connector configuration
#[derive(Clone)]

View File

@ -83,9 +83,9 @@ impl Connector<(), ()> {
}
}
// Build Ssl connector based on features config and supplied alpn protocols
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector {
// Build Ssl connector with openssl, based on supplied alpn protocols
#[cfg(feature = "openssl")]
fn build_ssl(protocols: Vec<Vec<u8>>) -> SslConnector
{
use actix_connect::ssl::openssl::SslMethod;
use bytes::{BufMut, BytesMut};
@ -102,7 +102,10 @@ impl Connector<(), ()> {
.map_err(|e| error!("Can not set alpn protocol: {:?}", e));
SslConnector::Openssl(ssl.build())
}
// 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
{
let mut config = ClientConfig::new();
config.set_protocols(&protocols);
@ -111,9 +114,10 @@ impl Connector<(), ()> {
.add_server_trust_anchors(&actix_tls::rustls::TLS_SERVER_ROOTS);
SslConnector::Rustls(Arc::new(config))
}
// ssl turned off, provides empty ssl connector
#[cfg(not(any(feature = "openssl", feature = "rustls")))]
{}
}
fn build_ssl(_: Vec<Vec<u8>>) -> SslConnector {}
}
impl<T, U> Connector<T, U> {