Skip to content

Commit eab7cbf

Browse files
authored
v0.6.9
1 parent 9c64770 commit eab7cbf

2 files changed

Lines changed: 55 additions & 4 deletions

File tree

tower-http/CHANGELOG.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,77 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
# Unreleased
8+
# 0.6.9
99

1010
## Added:
1111

1212
- `on-early-drop`: middleware that detects when a response future or response
1313
body is dropped before completion ([#636])
1414

15+
Two events get hooks: the response future being dropped before
16+
the inner service produces a response, and the response body being
17+
dropped before reaching end-of-stream.
18+
19+
Install custom callbacks with `OnEarlyDropLayer::builder()`:
20+
21+
```rust
22+
use http::Request;
23+
use tower_http::on_early_drop::{OnBodyDropFn, OnEarlyDropLayer};
24+
25+
let layer = OnEarlyDropLayer::builder()
26+
.on_future_drop(|req: &Request<()>| {
27+
let uri = req.uri().clone();
28+
move || eprintln!("future dropped for {}", uri)
29+
})
30+
.on_body_drop(OnBodyDropFn::new(|req: &Request<()>| {
31+
let uri = req.uri().clone();
32+
move |parts: &http::response::Parts| {
33+
let status = parts.status;
34+
move || eprintln!("body dropped for {} status {}", uri, status)
35+
}
36+
}));
37+
```
38+
39+
Or route both events through a `trace::OnFailure` hook with
40+
`EarlyDropsAsFailures`. Place this layer inside a `TraceLayer` so the
41+
emitted events inherit the request span:
42+
43+
```rust
44+
use tower::ServiceBuilder;
45+
use tower_http::on_early_drop::{OnEarlyDropLayer, EarlyDropsAsFailures};
46+
use tower_http::trace::{DefaultOnFailure, TraceLayer};
47+
48+
let stack = ServiceBuilder::new()
49+
.layer(TraceLayer::new_for_http())
50+
.layer(OnEarlyDropLayer::new(
51+
EarlyDropsAsFailures::new(DefaultOnFailure::default()),
52+
));
53+
```
54+
- `fs`: make `AsyncReadBody::with_capacity` public ([#415])
55+
1556
## Changed:
1657

17-
- The implicit `async-compression` feature is removed (BREAKING) ([#642])
18-
- The implicit `tokio` feature is removed (BREAKING) ([#628])
58+
- The implicit `async-compression` feature is removed ([#642])
59+
- The implicit `tokio` feature is removed ([#628])
60+
- `fs`: no longer auto-enables the `tracing` crate feature; enable `tracing`
61+
explicitly to restore error logging on `ServeDir` IO failures ([#614])
1962

2063
## Fixed
2164

2265
- `trace`: restore failure classification at end-of-stream ([#483])
66+
- `follow-redirect`: support unicode URLs (swaps `iri-string` dep for
67+
`url`) ([#646])
68+
- `fs`: reject reserved Windows DOS device names (`CON`, `COM1`, etc.) in
69+
`ServeDir` ([#663])
2370

71+
[#415]: https://github.com/tower-rs/tower-http/pull/415
2472
[#483]: https://github.com/tower-rs/tower-http/pull/483
73+
[#614]: https://github.com/tower-rs/tower-http/pull/614
2574
[#628]: https://github.com/tower-rs/tower-http/pull/628
2675
[#636]: https://github.com/tower-rs/tower-http/pull/636
2776
[#642]: https://github.com/tower-rs/tower-http/pull/642
77+
[#646]: https://github.com/tower-rs/tower-http/pull/646
78+
[#663]: https://github.com/tower-rs/tower-http/pull/663
2879

2980
# 0.6.8
3081

tower-http/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tower-http"
33
description = "Tower middleware and utilities for HTTP clients and servers"
4-
version = "0.6.8"
4+
version = "0.6.9"
55
authors = ["Tower Maintainers <team@tower-rs.com>"]
66
edition = "2018"
77
license = "MIT"

0 commit comments

Comments
 (0)