mirror of
https://github.com/ntex-rs/ntex.git
synced 2025-04-04 05:17: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
|
||||
|
||||
## [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
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "ntex"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
authors = ["ntex contributors <team@ntex.rs>"]
|
||||
description = "Framework for composable network services"
|
||||
readme = "README.md"
|
||||
|
|
|
@ -232,7 +232,7 @@ impl RequestHeadType {
|
|||
timeout: Millis,
|
||||
config: &ClientConfig,
|
||||
) -> 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>(
|
||||
|
|
|
@ -386,6 +386,7 @@ impl Accept {
|
|||
match self.workers[self.next].send(msg) {
|
||||
Ok(_) => (),
|
||||
Err(tmp) => {
|
||||
self.update_status(ServerStatus::WorkerFailed);
|
||||
self.srv.worker_faulted(self.workers[self.next].idx);
|
||||
msg = tmp;
|
||||
self.workers.swap_remove(self.next);
|
||||
|
@ -413,6 +414,7 @@ impl Accept {
|
|||
}
|
||||
Err(tmp) => {
|
||||
trace!("Worker failed while processing connection");
|
||||
self.update_status(ServerStatus::WorkerFailed);
|
||||
self.srv.worker_faulted(self.workers[self.next].idx);
|
||||
msg = tmp;
|
||||
self.workers.swap_remove(self.next);
|
||||
|
|
|
@ -128,7 +128,6 @@ impl ServerBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
/// Set server status handler.
|
||||
///
|
||||
/// 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)]
|
||||
pub use self::socket::FromStream;
|
||||
|
||||
#[non_exhaustive]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
/// Server readiness status
|
||||
pub enum ServerStatus {
|
||||
Ready,
|
||||
NotReady,
|
||||
WorkerFailed,
|
||||
}
|
||||
|
||||
/// Socket id token
|
||||
|
|
|
@ -247,6 +247,7 @@ mod tests {
|
|||
assert!(second_time - first_time >= time::Duration::from_millis(wait_time));
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
#[crate::rt_test]
|
||||
async fn test_interval() {
|
||||
let mut int = interval(Millis(250));
|
||||
|
@ -272,6 +273,7 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
#[crate::rt_test]
|
||||
async fn test_interval_one_sec() {
|
||||
let int = interval(Millis::ONE_SEC);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue