Skip to content

sapi/cli: Accept request paths split across reads - #450

Closed
iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-cli-split-path-84
Closed

iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-cli-split-path-84

Conversation

@iliaal

@iliaal iliaal commented Nov 2, 2026

Copy link
Copy Markdown
Owner

The CLI server rejects a request when its path arrives in multiple reads. The server now accumulates the raw path and normalizes it once before translation, preserving percent escapes and dot segments across fragments. Query strings and request URIs already concatenate fragments. A second message is rejected at message start to preserve the previous handling of pipelined requests.

Found during source review and reproduced with PHP 8.4's built-in server on Linux. The oversized-path test still checks rejection beyond the parser's 80 KiB header limit.

The HTTP parser invokes on_path once per read that carries part of the
path, but the built-in server normalized the first piece and rejected
any further call, so a path longer than one 16 KiB read, or one that
arrived in several TCP segments, failed as a malformed request. Collect
the raw path and normalize it once the message is complete, which also
resolves percent escapes and dot segments split across reads. A second
request in the same read is now rejected in on_message_begin, since its
path, URI, and query string would otherwise be appended to the first.
@iliaal
iliaal force-pushed the fix/aph-cli-split-path-84 branch from efa8d02 to d5f0b8f Compare November 7, 2026 16:57
@iliaal

iliaal commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Promoted upstream as php#25291.

@iliaal iliaal closed this Nov 7, 2026
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.

1 participant