mirror of https://github.com/fafhrd91/actix-web
Compare commits
5 Commits
90c8b31a0f
...
a5d877e9c7
Author | SHA1 | Date |
---|---|---|
|
a5d877e9c7 | |
|
8996198f2c | |
|
68624ec63b | |
|
bcd0ffb016 | |
|
af30b7e679 |
|
@ -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 }
|
||||||
|
|
|
@ -386,7 +386,14 @@ where
|
||||||
let mut this = self.project();
|
let mut this = self.project();
|
||||||
this.state.set(match size {
|
this.state.set(match size {
|
||||||
BodySize::None | BodySize::Sized(0) => {
|
BodySize::None | BodySize::Sized(0) => {
|
||||||
this.flags.insert(Flags::FINISHED);
|
let payload_unfinished = this.payload.is_some();
|
||||||
|
|
||||||
|
if payload_unfinished {
|
||||||
|
this.flags.insert(Flags::SHUTDOWN | Flags::FINISHED);
|
||||||
|
} else {
|
||||||
|
this.flags.insert(Flags::FINISHED);
|
||||||
|
}
|
||||||
|
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
_ => State::SendPayload { body },
|
_ => State::SendPayload { body },
|
||||||
|
@ -404,7 +411,14 @@ where
|
||||||
let mut this = self.project();
|
let mut this = self.project();
|
||||||
this.state.set(match size {
|
this.state.set(match size {
|
||||||
BodySize::None | BodySize::Sized(0) => {
|
BodySize::None | BodySize::Sized(0) => {
|
||||||
this.flags.insert(Flags::FINISHED);
|
let payload_unfinished = this.payload.is_some();
|
||||||
|
|
||||||
|
if payload_unfinished {
|
||||||
|
this.flags.insert(Flags::SHUTDOWN | Flags::FINISHED);
|
||||||
|
} else {
|
||||||
|
this.flags.insert(Flags::FINISHED);
|
||||||
|
}
|
||||||
|
|
||||||
State::None
|
State::None
|
||||||
}
|
}
|
||||||
_ => State::SendErrorPayload { body },
|
_ => State::SendErrorPayload { body },
|
||||||
|
@ -503,10 +517,25 @@ where
|
||||||
Poll::Ready(None) => {
|
Poll::Ready(None) => {
|
||||||
this.codec.encode(Message::Chunk(None), this.write_buf)?;
|
this.codec.encode(Message::Chunk(None), this.write_buf)?;
|
||||||
|
|
||||||
|
// if we have not yet pipelined to the next request, then
|
||||||
|
// this.payload was the payload for the request we just finished
|
||||||
|
// responding to. We can check to see if we finished reading it
|
||||||
|
// yet, and if not, shutdown the connection.
|
||||||
|
let payload_unfinished = this.payload.is_some();
|
||||||
|
let not_pipelined = this.messages.is_empty();
|
||||||
|
|
||||||
|
println!("not pipelined: {not_pipelined}");
|
||||||
|
println!("payload unfinished: {payload_unfinished}");
|
||||||
|
|
||||||
// payload stream finished.
|
// payload stream finished.
|
||||||
// set state to None and handle next message
|
// set state to None and handle next message
|
||||||
this.state.set(State::None);
|
this.state.set(State::None);
|
||||||
this.flags.insert(Flags::FINISHED);
|
|
||||||
|
if not_pipelined && payload_unfinished {
|
||||||
|
this.flags.insert(Flags::SHUTDOWN | Flags::FINISHED);
|
||||||
|
} else {
|
||||||
|
this.flags.insert(Flags::FINISHED);
|
||||||
|
}
|
||||||
|
|
||||||
continue 'res;
|
continue 'res;
|
||||||
}
|
}
|
||||||
|
@ -542,10 +571,25 @@ where
|
||||||
Poll::Ready(None) => {
|
Poll::Ready(None) => {
|
||||||
this.codec.encode(Message::Chunk(None), this.write_buf)?;
|
this.codec.encode(Message::Chunk(None), this.write_buf)?;
|
||||||
|
|
||||||
// payload stream finished
|
// if we have not yet pipelined to the next request, then
|
||||||
|
// this.payload was the payload for the request we just finished
|
||||||
|
// responding to. We can check to see if we finished reading it
|
||||||
|
// yet, and if not, shutdown the connection.
|
||||||
|
let payload_unfinished = this.payload.is_some();
|
||||||
|
let not_pipelined = this.messages.is_empty();
|
||||||
|
|
||||||
|
println!("not pipelined: {not_pipelined}");
|
||||||
|
println!("payload unfinished: {payload_unfinished}");
|
||||||
|
|
||||||
|
// payload stream finished.
|
||||||
// set state to None and handle next message
|
// set state to None and handle next message
|
||||||
this.state.set(State::None);
|
this.state.set(State::None);
|
||||||
this.flags.insert(Flags::FINISHED);
|
|
||||||
|
if not_pipelined && payload_unfinished {
|
||||||
|
this.flags.insert(Flags::SHUTDOWN | Flags::FINISHED);
|
||||||
|
} else {
|
||||||
|
this.flags.insert(Flags::FINISHED);
|
||||||
|
}
|
||||||
|
|
||||||
continue 'res;
|
continue 'res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -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