-
-
Notifications
You must be signed in to change notification settings - Fork 164
Server Facade #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Server Facade #271
Conversation
c988dcb
to
d9b773d
Compare
Ping @clue new middleware is included in the Server facade now. Decided to go with a strategy that bases the amount of concurrently handled requests on the memory limit and post size limit. |
src/Server.php
Outdated
* Wraps StreamingServer with the following middleware: | ||
* - RequestBodyBufferMiddleware | ||
* - RequestBodyParserMiddleware | ||
* - The callable you in passed as first constructor argument |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LimitConcurrentRequestsMiddleware
missing now here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed that 👍
Added documentation to the readme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, I really like the direction this is heading! 👍 I think this will need a major documentation overhaul, but this is definitely a very good first step! 👍
* - upload_max_filesize | ||
* - post_max_size | ||
* - max_input_nesting_level | ||
* - max_input_vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also respects file_uploads
and max_file_uploads
ini settings as documented for RequestBodyParserMiddleware
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah my bad, added them 👍
src/Server.php
Outdated
* Wraps StreamingServer with the following middleware: | ||
* - LimitConcurrentRequestsMiddleware | ||
* - RequestBodyBufferMiddleware | ||
* - RequestBodyParserMiddleware |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the enable_post_data_reading
ini setting as documented for RequestBodyParserMiddleware
? Arguably, we may want to remove the RequestBodyParserMiddleware
from the middleware list in this case to mimic PHP's default behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the PR to respect enable_post_data_reading
src/Server.php
Outdated
$middleware = array(); | ||
$middleware[] = new LimitConcurrentRequestsMiddleware($this->getConcurrentRequestsLimit()); | ||
$middleware[] = new RequestBodyBufferMiddleware(); | ||
if (ini_get('enable_post_data_reading')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails with HHVM and legacy PHP < 5.4: https://3v4l.org/qJtsa
$ php -d enable_post_data_reading=no -r 'var_dump(ini_get("enable_post_data_reading"));'
string(0) ""
Accordingly, this should probably check for !== ''
instead? Also, can you add a comment for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm interesting, but what happens then when set to 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to http://php.net/manual/en/ini.core.php#ini.enable-post-data-reading it's a boolean
. See also http://php.net/manual/en/function.ini-get.php#refsect1-function.ini-get-notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the check
1991ec5
to
10745f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally LGTM and would love to get this in Can you fix the failing tests and squash this to a reasonable number of commits? 👍
63fc55d
to
40e8517
Compare
@clue fixed the test and squashed the commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
src/Server.php
Outdated
*/ | ||
final class Server | ||
{ | ||
const MAXIMUM_CONCURRENT_REQUESTS = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick: Should probably be @internal
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, added that 👍
40e8517
to
a37b4bc
Compare
Follow up on #266 reintroducing the
Server
class but this time as a facade aroundStreamingServer
.Closes #259