Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']#7207
Closed
cmb69 wants to merge 5 commits intophp:PHP-7.4from
Closed
Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']#7207cmb69 wants to merge 5 commits intophp:PHP-7.4from
cmb69 wants to merge 5 commits intophp:PHP-7.4from
Conversation
The built-in Webserver's `on_path`, `on_query_string` and `on_url` callbacks may be called multiple times from the parser; we must not simply replace the old values, but need to concatenate the new values instead. This appears to be tricky for `on_path` due to the path normalization, so we fail if the function is called again.
nikic
reviewed
Jun 29, 2021
Codecov Report
@@ Coverage Diff @@
## PHP-7.4 #7207 +/- ##
===========================================
+ Coverage 72.99% 73.02% +0.02%
===========================================
Files 803 803
Lines 283801 283937 +136
===========================================
+ Hits 207155 207338 +183
+ Misses 76646 76599 -47
Continue to review full report at Codecov.
|
The total length of the HTTP headers is already restricted to at most `PHP_HTTP_MAX_HEADER_SIZE` bytes, so no integer overflow can occur in our calculations.
nikic
approved these changes
Jun 30, 2021
nikic
reviewed
Jun 30, 2021
The built-in Webserver logs errors during request parsing to stderr, but this is ignored by the php_cli_server framework, and apparently the Webserver does not send a resonse at all in such cases (instead of an 4xx). Thus we can only check that a request with an overly long path fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The built-in Webserver's
on_path,on_query_stringandon_urlcallbacks may be called multiple times from the parser; we must not
simply replace the old values, but need to concatenate the new values
instead.
This appears to be tricky for
on_pathdue to the path normalization,so we fail if the function is called again.