Skip to content

Commit e724f3a

Browse files
committed
feat: use X-Request-Body-Stream header for streaming uploads
Transfer-Encoding: chunked is stripped by HTTP/2+ proxies (Cloudflare). Use a custom X-Request-Body-Stream header as the opt-in signal for streaming request bodies.
1 parent 9a69a4c commit e724f3a

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "openworkers-runner"
3-
version = "0.14.2"
3+
version = "0.14.3"
44
edition = "2024"
55
license = "MIT"
66
default-run = "openworkers-runner"

bin/main.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,14 +462,11 @@ async fn handle_worker_request(
462462

463463
let start = tokio::time::Instant::now();
464464

465-
let is_chunked = headers
466-
.get("transfer-encoding")
467-
.and_then(|v| v.to_str().ok())
468-
.is_some_and(|v| v.eq_ignore_ascii_case("chunked"));
465+
let is_streaming = headers.contains_key("x-request-body-stream");
469466

470467
let mut pump_handle: Option<tokio::task::JoinHandle<()>> = None;
471468

472-
let mut request = if is_chunked {
469+
let mut request = if is_streaming {
473470
// Streaming path: pipe body chunks to the worker via mpsc channel.
474471
// Guards: 30s idle timeout per chunk, 10MB max total body size.
475472
const CHUNK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(5);

0 commit comments

Comments
 (0)