Commit affb46c
committed
Harden the streaming publisher pipeline after review
Address the deep-review findings on the streaming cutover:
- Cap cumulative decoded bytes in BodyStreamDecoder against
publisher.max_buffered_body_bytes: the chunk source only bounds raw
compressed bytes, so a decompression bomb could expand ~1000x past it
and push unbounded decoded volume through the rewrite pipeline
- Detect truncated deflate streams: write::ZlibDecoder::try_finish
accepts truncated input silently, so the deflate arm now drives
flate2::Decompress directly and requires Status::StreamEnd at
finalization; trailing bytes after the end marker stay ignored.
Add truncated-gzip and truncated-deflate regression tests
- Make BodyChunkSource::next_chunk cancellation-safe by polling the
body in place instead of moving it out across an await; a cancelled
pull no longer turns into a silent EOF
- Log dispatched auctions dropped uncollected (client disconnect
mid-stream or never-polled body) via DispatchedAuctionGuard; the
guard is created before the lazy stream so unpolled drops log too
- Share the pull+decode step between the lazy publisher body and the
write-sink drivers (hold_step_next_chunk / passthrough_step),
removing the unreachable!() error plumbing and the triplicated
processor selection; document body_close_hold_loop_stream as
groundwork for the buffered adapters' streaming cutover
- Pass identity-encoded chunks through zero-copy and finish encoders
by consuming them instead of allocating a throwaway replacement
- Add a Fastly dispatch test asserting the publisher fallback returns
Body::Stream without a stale Content-Length, plus a comment on why
the publisher fetch gates streaming on capability while the asset
path does not
Behavior note: gzip bodies with trailing garbage after the trailer now
error mid-stream; the old read-path decoder ignored them.1 parent 35e872b commit affb46c
4 files changed
Lines changed: 685 additions & 298 deletions
File tree
- crates
- trusted-server-adapter-fastly/src
- trusted-server-core/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2150 | 2150 | | |
2151 | 2151 | | |
2152 | 2152 | | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
2153 | 2157 | | |
2154 | 2158 | | |
2155 | 2159 | | |
| |||
2260 | 2264 | | |
2261 | 2265 | | |
2262 | 2266 | | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
2263 | 2297 | | |
2264 | 2298 | | |
2265 | 2299 | | |
| |||
0 commit comments