Skip to content

fix(http): advertise Deno.serve keep-alive timeout#34172

Open
lunadogbot wants to merge 2 commits into
mainfrom
orch/issue-135
Open

fix(http): advertise Deno.serve keep-alive timeout#34172
lunadogbot wants to merge 2 commits into
mainfrom
orch/issue-135

Conversation

@lunadogbot
Copy link
Copy Markdown
Contributor

Fixes #32497.
Closes bartlomieju/orchid-inbox#135

This adds a keepAliveTimeout option for TCP Deno.serve HTTP/1.1 servers. When set to a non-zero value, Deno configures Hyper with a timer-backed HTTP/1 header read timeout so idle keep-alive connections close on the configured schedule, and responses advertise the lifetime with Keep-Alive: timeout=N.

Verification:

  • cargo fmt --check
  • deno fmt --check tests/unit/serve_test.ts cli/tsc/dts/lib.deno.ns.d.ts
  • cargo check -p deno_http
  • cargo test -p deno_http test_handle_request
  • cargo build -p deno
  • ./target/debug/deno test --no-check -A --config tests/config/deno.json tests/unit/serve_test.ts --filter httpServerKeepAliveTimeoutAdvertisedAndEnforced
  • cargo test -p deno --test integration serve:: -- --nocapture

Note: direct unit test execution required initializing tests/util/std so the repo import map could resolve local std test utilities.

Copy link
Copy Markdown
Contributor

@fibibot fibibot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The option is validated before reaching the op boundary, the Rust plumbing keeps it scoped to HTTP/1 serving, and the test covers both the advertised header and idle connection closure. CI is green.\n\n@bartlomieju this looks ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deno.serve causes connection reset errors when behind a reverse proxy with keep-alive connection pooling

2 participants