Skip to content

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

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

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

Conversation

@iliaal

@iliaal iliaal commented Nov 7, 2026

Copy link
Copy Markdown
Member

When a request path reaches php -S across more than one read (a path over the 16 KiB read buffer, or one sent in several segments), the server drops the request as malformed. d7db570 made the URI and query string callbacks concatenate but left on_path rejecting a second call; this collects the raw path and normalizes it once the message is complete. A second request pipelined into the same read is rejected in on_message_begin, so its path cannot be appended to the first.

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 closed this in 78d08f5 Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants