Skip to content
This repository has been archived by the owner on Jan 17, 2022. It is now read-only.

Commit

Permalink
feat(server): Add setting for "buffer_output_size" (#33)
Browse files Browse the repository at this point in the history
Make it possible to increase the max content length of response
  • Loading branch information
fjogeleit authored and k911 committed Mar 16, 2019
1 parent e76729a commit 7a50864
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('pid_file')
->defaultNull()
->end()
->scalarNode('buffer_output_size')
->defaultValue(2097152)
->end()
->integerNode('worker_count')
->min(1)
->end()
Expand Down
7 changes: 7 additions & 0 deletions src/Server/HttpServerConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class HttpServerConfiguration
'log_file' => 'log_file',
'log_level' => 'log_level',
'pid_file' => 'pid_file',
'buffer_output_size' => 'buffer_output_size',
];

private const SWOOLE_SERVE_STATIC = [
Expand Down Expand Up @@ -53,6 +54,7 @@ final class HttpServerConfiguration
* - worker_count (default: 2 * number of cpu cores)
* - serve_static_files (default: false)
* - public_dir (default: '%kernel.root_dir%/public')
* - buffer_output_size (default: '2097152' unit in byte (2MB))
*
* @throws \Assert\AssertionFailedException
*/
Expand Down Expand Up @@ -122,6 +124,11 @@ private function validateSetting(string $key, $value): void
Assertion::inArray($value, \array_keys(self::SWOOLE_LOG_LEVELS));
}

if ('buffer_output_size' === $key) {
Assertion::integer($value, \sprintf('Setting "%s" must be an integer.', $key));
Assertion::greaterThan($value, 0, 'Buffer output size value cannot be negative or zero, "%s" provided.');
}

if (\in_array($key, ['reactor_count', 'worker_count'], true)) {
Assertion::integer($value, \sprintf('Setting "%s" must be an integer.', $key));
Assertion::greaterThan($value, 0, 'Count value cannot be negative, "%s" provided.');
Expand Down

0 comments on commit 7a50864

Please sign in to comment.