mirror of https://github.com/fafhrd91/actix-web
Compare commits
6 Commits
803af86f08
...
c44d778f26
Author | SHA1 | Date |
---|---|---|
|
c44d778f26 | |
|
8996198f2c | |
|
68624ec63b | |
|
bcd0ffb016 | |
|
bb2c6cebfd | |
|
0cb453e499 |
|
@ -17,7 +17,6 @@ edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
|
||||||
features = [
|
features = [
|
||||||
"http2",
|
"http2",
|
||||||
"ws",
|
"ws",
|
||||||
|
@ -119,7 +118,7 @@ tokio-util = { version = "0.7", features = ["io", "codec"] }
|
||||||
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
||||||
|
|
||||||
# http2
|
# http2
|
||||||
h2 = { version = "0.3.26", optional = true }
|
h2 = { version = "0.3.27", optional = true }
|
||||||
|
|
||||||
# websockets
|
# websockets
|
||||||
base64 = { version = "0.22", optional = true }
|
base64 = { version = "0.22", optional = true }
|
||||||
|
|
|
@ -11,7 +11,6 @@ edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -14,7 +14,6 @@ license.workspace = true
|
||||||
edition.workspace = true
|
edition.workspace = true
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
||||||
[package.metadata.cargo_check_external_types]
|
[package.metadata.cargo_check_external_types]
|
||||||
|
|
|
@ -17,7 +17,6 @@ edition.workspace = true
|
||||||
rust-version.workspace = true
|
rust-version.workspace = true
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
|
||||||
features = [
|
features = [
|
||||||
"macros",
|
"macros",
|
||||||
"openssl",
|
"openssl",
|
||||||
|
|
|
@ -110,14 +110,22 @@ where
|
||||||
|
|
||||||
#[allow(clippy::borrow_interior_mutable_const)]
|
#[allow(clippy::borrow_interior_mutable_const)]
|
||||||
fn call(&self, req: ServiceRequest) -> Self::Future {
|
fn call(&self, req: ServiceRequest) -> Self::Future {
|
||||||
|
if req.extensions().get::<Encoding>().is_some() {
|
||||||
|
return Either::left(CompressResponse {
|
||||||
|
fut: self.service.call(req),
|
||||||
|
_phantom: PhantomData,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// negotiate content-encoding
|
// negotiate content-encoding
|
||||||
let accept_encoding = req.get_header::<AcceptEncoding>();
|
let accept_encoding = req.get_header::<AcceptEncoding>();
|
||||||
|
|
||||||
let accept_encoding = match accept_encoding {
|
let accept_encoding = match accept_encoding {
|
||||||
// missing header; fallback to identity
|
// missing header; fallback to identity
|
||||||
None => {
|
None => {
|
||||||
|
req.extensions_mut().insert::<Encoding>(Encoding::identity());
|
||||||
|
|
||||||
return Either::left(CompressResponse {
|
return Either::left(CompressResponse {
|
||||||
encoding: Encoding::identity(),
|
|
||||||
fut: self.service.call(req),
|
fut: self.service.call(req),
|
||||||
_phantom: PhantomData,
|
_phantom: PhantomData,
|
||||||
})
|
})
|
||||||
|
@ -143,11 +151,14 @@ where
|
||||||
.map_into_right_body()))
|
.map_into_right_body()))
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(encoding) => Either::left(CompressResponse {
|
Some(encoding) => {
|
||||||
fut: self.service.call(req),
|
req.extensions_mut().insert::<Encoding>(encoding);
|
||||||
encoding,
|
|
||||||
_phantom: PhantomData,
|
Either::left(CompressResponse {
|
||||||
}),
|
fut: self.service.call(req),
|
||||||
|
_phantom: PhantomData,
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,7 +170,6 @@ pin_project! {
|
||||||
{
|
{
|
||||||
#[pin]
|
#[pin]
|
||||||
fut: S::Future,
|
fut: S::Future,
|
||||||
encoding: Encoding,
|
|
||||||
_phantom: PhantomData<B>,
|
_phantom: PhantomData<B>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,8 +186,19 @@ where
|
||||||
|
|
||||||
match ready!(this.fut.poll(cx)) {
|
match ready!(this.fut.poll(cx)) {
|
||||||
Ok(resp) => {
|
Ok(resp) => {
|
||||||
let enc = match this.encoding {
|
let request_encoding = resp.request().extensions().get::<Encoding>().cloned();
|
||||||
Encoding::Known(enc) => *enc,
|
|
||||||
|
let encoding = match request_encoding {
|
||||||
|
Some(enc) => enc.clone(),
|
||||||
|
None => {
|
||||||
|
return Poll::Ready(Ok(resp.map_body(move |head, body| {
|
||||||
|
EitherBody::left(Encoder::response(ContentEncoding::Identity, head, body))
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let enc = match encoding {
|
||||||
|
Encoding::Known(enc) => enc,
|
||||||
Encoding::Unknown(enc) => {
|
Encoding::Unknown(enc) => {
|
||||||
unimplemented!("encoding '{enc}' should not be here");
|
unimplemented!("encoding '{enc}' should not be here");
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
|
||||||
features = [
|
features = [
|
||||||
"cookies",
|
"cookies",
|
||||||
"openssl",
|
"openssl",
|
||||||
|
@ -109,7 +108,7 @@ cfg-if = "1"
|
||||||
derive_more = { version = "2", features = ["display", "error", "from"] }
|
derive_more = { version = "2", features = ["display", "error", "from"] }
|
||||||
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||||
futures-util = { version = "0.3.17", default-features = false, features = ["alloc", "sink"] }
|
futures-util = { version = "0.3.17", default-features = false, features = ["alloc", "sink"] }
|
||||||
h2 = "0.3.26"
|
h2 = "0.3.27"
|
||||||
http = "0.2.7"
|
http = "0.2.7"
|
||||||
itoa = "1"
|
itoa = "1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# developed on macOS and probably doesn't work on Linux yet due to minor
|
# developed on macOS and probably doesn't work on Linux yet due to minor
|
||||||
# differences in flags on sed
|
# differences in flags on sed
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# run tests matching what CI does for non-linux feature sets
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
EXIT=0
|
|
||||||
|
|
||||||
save_exit_code() {
|
|
||||||
eval $@
|
|
||||||
local CMD_EXIT=$?
|
|
||||||
[ "$CMD_EXIT" = "0" ] || EXIT=$CMD_EXIT
|
|
||||||
}
|
|
||||||
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-router --all-features -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-http --all-features -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-web --features=rustls,openssl -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-web-codegen --all-features -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=awc --all-features -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-http-test --all-features -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-test --all-features -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-files -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-multipart --all-features -- --nocapture
|
|
||||||
save_exit_code cargo test --lib --tests -p=actix-web-actors --all-features -- --nocapture
|
|
||||||
|
|
||||||
save_exit_code cargo test --workspace --doc
|
|
||||||
|
|
||||||
if [ "$EXIT" = "0" ]; then
|
|
||||||
PASSED="All tests passed!"
|
|
||||||
|
|
||||||
if [ "$(command -v figlet)" ]; then
|
|
||||||
figlet "$PASSED"
|
|
||||||
else
|
|
||||||
echo "$PASSED"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $EXIT
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -Euo pipefail
|
||||||
|
|
||||||
|
for dir in $@; do
|
||||||
|
cd "$dir"
|
||||||
|
|
||||||
|
cargo publish --dry-run
|
||||||
|
|
||||||
|
read -p "Look okay? "
|
||||||
|
read -p "Sure? "
|
||||||
|
|
||||||
|
cargo publish
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo
|
||||||
|
read -p "Was the above error caused by cyclic dev-deps? Choosing yes will publish without a git backreference. (y/N) " publish_no_dev_deps
|
||||||
|
|
||||||
|
if [[ "$publish_no_dev_deps" == "y" || "$publish_no_dev_deps" == "Y" ]]; then
|
||||||
|
cargo hack --no-dev-deps publish --allow-dirty
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
done
|
Loading…
Reference in New Issue