mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
update trust-dns
This commit is contained in:
parent
ab4fda6084
commit
002c41a7ca
@ -1,5 +1,11 @@
|
|||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
* use trust-dns-resolver 0.11.0
|
||||||
|
|
||||||
|
|
||||||
## [0.1.0-alpha.5] - 2019-04-12
|
## [0.1.0-alpha.5] - 2019-04-12
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -81,7 +81,7 @@ time = "0.1"
|
|||||||
tokio-tcp = "0.1.3"
|
tokio-tcp = "0.1.3"
|
||||||
tokio-timer = "0.2"
|
tokio-timer = "0.2"
|
||||||
tokio-current-thread = "0.1"
|
tokio-current-thread = "0.1"
|
||||||
trust-dns-resolver = { version="0.11.0-alpha.3", default-features = false }
|
trust-dns-resolver = { version="0.11.0", default-features = false }
|
||||||
|
|
||||||
# for secure cookie
|
# for secure cookie
|
||||||
ring = { version = "0.14.6", optional = true }
|
ring = { version = "0.14.6", optional = true }
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
use std::io::Write;
|
use std::io::{Read, Write};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use brotli2::write::BrotliEncoder;
|
use brotli2::write::BrotliEncoder;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
use flate2::read::GzDecoder;
|
||||||
use flate2::write::GzEncoder;
|
use flate2::write::GzEncoder;
|
||||||
use flate2::Compression;
|
use flate2::Compression;
|
||||||
use futures::future::Future;
|
use futures::future::Future;
|
||||||
@ -11,6 +12,7 @@ use rand::Rng;
|
|||||||
use actix_http::HttpService;
|
use actix_http::HttpService;
|
||||||
use actix_http_test::TestServer;
|
use actix_http_test::TestServer;
|
||||||
use actix_web::http::Cookie;
|
use actix_web::http::Cookie;
|
||||||
|
use actix_web::middleware::{BodyEncoding, Compress};
|
||||||
use actix_web::{http::header, web, App, Error, HttpMessage, HttpRequest, HttpResponse};
|
use actix_web::{http::header, web, App, Error, HttpMessage, HttpRequest, HttpResponse};
|
||||||
use awc::error::SendRequestError;
|
use awc::error::SendRequestError;
|
||||||
|
|
||||||
@ -95,11 +97,9 @@ fn test_timeout_override() {
|
|||||||
))))
|
))))
|
||||||
});
|
});
|
||||||
|
|
||||||
let client = srv.execute(|| {
|
let client = awc::Client::build()
|
||||||
awc::Client::build()
|
.timeout(Duration::from_millis(50000))
|
||||||
.timeout(Duration::from_millis(50000))
|
.finish();
|
||||||
.finish()
|
|
||||||
});
|
|
||||||
let request = client
|
let request = client
|
||||||
.get(srv.url("/"))
|
.get(srv.url("/"))
|
||||||
.timeout(Duration::from_millis(50))
|
.timeout(Duration::from_millis(50))
|
||||||
@ -110,58 +110,77 @@ fn test_timeout_override() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn test_connection_close() {
|
fn test_connection_close() {
|
||||||
// let mut srv =
|
let mut srv = TestServer::new(|| {
|
||||||
// test::TestServer::new(|app| app.handler(|_| HttpResponse::Ok().body(STR)));
|
HttpService::new(
|
||||||
|
App::new().service(web::resource("/").to(|| HttpResponse::Ok())),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
// let request = srv.get("/").header("Connection", "close").finish().unwrap();
|
let res = srv
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
.block_on(awc::Client::new().get(srv.url("/")).force_close().send())
|
||||||
// assert!(response.status().is_success());
|
.unwrap();
|
||||||
// }
|
assert!(res.status().is_success());
|
||||||
|
}
|
||||||
|
|
||||||
// #[test]
|
#[test]
|
||||||
// fn test_with_query_parameter() {
|
fn test_with_query_parameter() {
|
||||||
// let mut srv = test::TestServer::new(|app| {
|
let mut srv = TestServer::new(|| {
|
||||||
// app.handler(|req: &HttpRequest| match req.query().get("qp") {
|
HttpService::new(App::new().service(web::resource("/").to(
|
||||||
// Some(_) => HttpResponse::Ok().finish(),
|
|req: HttpRequest| {
|
||||||
// None => HttpResponse::BadRequest().finish(),
|
if req.query_string().contains("qp") {
|
||||||
// })
|
HttpResponse::Ok()
|
||||||
// });
|
} else {
|
||||||
|
HttpResponse::BadRequest()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)))
|
||||||
|
});
|
||||||
|
|
||||||
// let request = srv.get("/").uri(srv.url("/?qp=5").as_str()).finish().unwrap();
|
let res = srv
|
||||||
|
.block_on(awc::Client::new().get(srv.url("/?qp=5")).send())
|
||||||
|
.unwrap();
|
||||||
|
assert!(res.status().is_success());
|
||||||
|
}
|
||||||
|
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
#[test]
|
||||||
// assert!(response.status().is_success());
|
fn test_no_decompress() {
|
||||||
// }
|
let mut srv = TestServer::new(|| {
|
||||||
|
HttpService::new(App::new().wrap(Compress::default()).service(
|
||||||
|
web::resource("/").route(web::to(|| {
|
||||||
|
let mut res = HttpResponse::Ok().body(STR);
|
||||||
|
res.encoding(header::ContentEncoding::Gzip);
|
||||||
|
res
|
||||||
|
})),
|
||||||
|
))
|
||||||
|
});
|
||||||
|
|
||||||
// #[test]
|
let mut res = srv
|
||||||
// fn test_no_decompress() {
|
.block_on(awc::Client::new().get(srv.url("/")).no_decompress().send())
|
||||||
// let mut srv =
|
.unwrap();
|
||||||
// test::TestServer::new(|app| app.handler(|_| HttpResponse::Ok().body(STR)));
|
assert!(res.status().is_success());
|
||||||
|
|
||||||
// let request = srv.get("/").disable_decompress().finish().unwrap();
|
// read response
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
let bytes = srv.block_on(res.body()).unwrap();
|
||||||
// assert!(response.status().is_success());
|
|
||||||
|
|
||||||
// // read response
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
let mut dec = Vec::new();
|
||||||
|
e.read_to_end(&mut dec).unwrap();
|
||||||
|
assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref()));
|
||||||
|
|
||||||
// let mut e = GzDecoder::new(&bytes[..]);
|
// POST
|
||||||
// let mut dec = Vec::new();
|
let mut res = srv
|
||||||
// e.read_to_end(&mut dec).unwrap();
|
.block_on(awc::Client::new().post(srv.url("/")).no_decompress().send())
|
||||||
// assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref()));
|
.unwrap();
|
||||||
|
assert!(res.status().is_success());
|
||||||
|
|
||||||
// // POST
|
let bytes = srv.block_on(res.body()).unwrap();
|
||||||
// let request = srv.post().disable_decompress().finish().unwrap();
|
let mut e = GzDecoder::new(&bytes[..]);
|
||||||
// let response = srv.execute(request.send()).unwrap();
|
let mut dec = Vec::new();
|
||||||
|
e.read_to_end(&mut dec).unwrap();
|
||||||
// let bytes = srv.execute(response.body()).unwrap();
|
assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref()));
|
||||||
// let mut e = GzDecoder::new(&bytes[..]);
|
}
|
||||||
// let mut dec = Vec::new();
|
|
||||||
// e.read_to_end(&mut dec).unwrap();
|
|
||||||
// assert_eq!(Bytes::from(dec), Bytes::from_static(STR.as_ref()));
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_client_gzip_encoding() {
|
fn test_client_gzip_encoding() {
|
||||||
|
Loading…
Reference in New Issue
Block a user