mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-05 13:57:39 +03:00
Content lenght fix (#59)
* Send ServerStatus::WorkerFailed update if worker is failed * Do not add content-length header for empty body #56
This commit is contained in:
parent
87915f945a
commit
b3fd4f6b2a
7 changed files with 17 additions and 5 deletions
|
@ -1,8 +1,14 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## [0.4.1] - 2021-09-23
|
## [0.4.1] - 2021-09-27
|
||||||
|
|
||||||
* framed::Read::resume() returns true if it was resumed
|
* server: Send `ServerStatus::WorkerFailed` update if worker is failed
|
||||||
|
|
||||||
|
* server: Make `ServerBuilder::status_handler()` public
|
||||||
|
|
||||||
|
* framed: Read::resume() returns true if it was paused before
|
||||||
|
|
||||||
|
* http::client: Do not add content-length header for empty body #56
|
||||||
|
|
||||||
## [0.4.0] - 2021-09-17
|
## [0.4.0] - 2021-09-17
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ntex"
|
name = "ntex"
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
authors = ["ntex contributors <team@ntex.rs>"]
|
authors = ["ntex contributors <team@ntex.rs>"]
|
||||||
description = "Framework for composable network services"
|
description = "Framework for composable network services"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -232,7 +232,7 @@ impl RequestHeadType {
|
||||||
timeout: Millis,
|
timeout: Millis,
|
||||||
config: &ClientConfig,
|
config: &ClientConfig,
|
||||||
) -> SendClientRequest {
|
) -> SendClientRequest {
|
||||||
self.send_body(addr, response_decompress, timeout, config, Body::Empty)
|
self.send_body(addr, response_decompress, timeout, config, Body::None)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_header_if_none<V>(
|
fn set_header_if_none<V>(
|
||||||
|
|
|
@ -386,6 +386,7 @@ impl Accept {
|
||||||
match self.workers[self.next].send(msg) {
|
match self.workers[self.next].send(msg) {
|
||||||
Ok(_) => (),
|
Ok(_) => (),
|
||||||
Err(tmp) => {
|
Err(tmp) => {
|
||||||
|
self.update_status(ServerStatus::WorkerFailed);
|
||||||
self.srv.worker_faulted(self.workers[self.next].idx);
|
self.srv.worker_faulted(self.workers[self.next].idx);
|
||||||
msg = tmp;
|
msg = tmp;
|
||||||
self.workers.swap_remove(self.next);
|
self.workers.swap_remove(self.next);
|
||||||
|
@ -413,6 +414,7 @@ impl Accept {
|
||||||
}
|
}
|
||||||
Err(tmp) => {
|
Err(tmp) => {
|
||||||
trace!("Worker failed while processing connection");
|
trace!("Worker failed while processing connection");
|
||||||
|
self.update_status(ServerStatus::WorkerFailed);
|
||||||
self.srv.worker_faulted(self.workers[self.next].idx);
|
self.srv.worker_faulted(self.workers[self.next].idx);
|
||||||
msg = tmp;
|
msg = tmp;
|
||||||
self.workers.swap_remove(self.next);
|
self.workers.swap_remove(self.next);
|
||||||
|
|
|
@ -128,7 +128,6 @@ impl ServerBuilder {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
|
||||||
/// Set server status handler.
|
/// Set server status handler.
|
||||||
///
|
///
|
||||||
/// Server calls this handler on every inner status update.
|
/// Server calls this handler on every inner status update.
|
||||||
|
|
|
@ -33,10 +33,13 @@ pub use self::test::{build_test_server, test_server, TestServer};
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use self::socket::FromStream;
|
pub use self::socket::FromStream;
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
/// Server readiness status
|
/// Server readiness status
|
||||||
pub enum ServerStatus {
|
pub enum ServerStatus {
|
||||||
Ready,
|
Ready,
|
||||||
NotReady,
|
NotReady,
|
||||||
|
WorkerFailed,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Socket id token
|
/// Socket id token
|
||||||
|
|
|
@ -247,6 +247,7 @@ mod tests {
|
||||||
assert!(second_time - first_time >= time::Duration::from_millis(wait_time));
|
assert!(second_time - first_time >= time::Duration::from_millis(wait_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
#[crate::rt_test]
|
#[crate::rt_test]
|
||||||
async fn test_interval() {
|
async fn test_interval() {
|
||||||
let mut int = interval(Millis(250));
|
let mut int = interval(Millis(250));
|
||||||
|
@ -272,6 +273,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "macos"))]
|
||||||
#[crate::rt_test]
|
#[crate::rt_test]
|
||||||
async fn test_interval_one_sec() {
|
async fn test_interval_one_sec() {
|
||||||
let int = interval(Millis::ONE_SEC);
|
let int = interval(Millis::ONE_SEC);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue