Skip to content

fix: close HTTP/1.0 streaming responses with unknown length - #560

Open
abu-tahir-0 wants to merge 1 commit into
reactphp:3.xfrom
abu-tahir-0:fix/http10-streaming-keepalive-552
Open

abu-tahir-0 wants to merge 1 commit into
reactphp:3.xfrom
abu-tahir-0:fix/http10-streaming-keepalive-552

Conversation

@abu-tahir-0

Copy link
Copy Markdown

Problem

An HTTP/1.0 client requesting Connection: keep-alive can wait indefinitely after an unknown-length streaming response. The server keeps the connection open without a framing mechanism that lets the client find the response boundary.

Root cause

The server accepted HTTP/1.0 keep-alive unconditionally. HTTP/1.0 cannot use chunked framing, so an unknown-length response must be close-delimited.

Solution

Retain HTTP/1.0 persistence only for bodyless responses, responses with Content-Length, and successful CONNECT tunnels. Preserve HTTP/1.1 behavior. Add unit and live-socket regressions for unknown-length and explicit-length responses.

Testing

  • New unit regressions: 3 tests, 11 assertions passed.
  • New functional regression: 1 test, 3 assertions passed.
  • Complete StreamingServerTest: 132 tests, 387 assertions passed.
  • PHP lint and Composer validation passed.
  • git diff --check: passed.
  • Full suite: 1,007 passed; 4 existing localhost client tests errored on Windows.

Closes #552

Only retain HTTP/1.0 keep-alive when the response boundary is known or no
response body is expected.
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.

HTTP server: Persistent connection on HTTP/1.0 hangs, when using streaming response body

1 participant