@@ -65,11 +65,11 @@ |
||
| 65 | 65 | { |
| 66 | 66 | declare (ticks = 1); |
| 67 | 67 | |
| 68 | - pcntl_signal(SIGINT, function () { |
|
| 68 | + pcntl_signal(SIGINT, function() { |
|
| 69 | 69 | throw new ShutdownException('Daemon shutdown requested (received SIGINT)'); |
| 70 | 70 | }); |
| 71 | 71 | |
| 72 | - pcntl_signal(SIGALRM, function () { |
|
| 72 | + pcntl_signal(SIGALRM, function() { |
|
| 73 | 73 | throw new TimeLimitException('Daemon time limit reached (received SIGALRM)'); |
| 74 | 74 | }); |
| 75 | 75 | } |
@@ -39,19 +39,19 @@ discard block |
||
| 39 | 39 | $this->kernel = $kernel; |
| 40 | 40 | $this->driverContainer = $driverContainer; |
| 41 | 41 | |
| 42 | - $name = $name ?: self::DEFAULT_NAME; |
|
| 42 | + $name = $name ?: self::DEFAULT_NAME; |
|
| 43 | 43 | $description = $description ?: self::DEFAULT_DESCRIPTION; |
| 44 | 44 | |
| 45 | 45 | parent::__construct($name); |
| 46 | 46 | |
| 47 | 47 | $this |
| 48 | 48 | ->setDescription($description) |
| 49 | - ->addOption('port', null, InputOption::VALUE_OPTIONAL, 'TCP port to listen on (if not present, daemon will listen on FCGI_LISTENSOCK_FILENO)') |
|
| 50 | - ->addOption('host', null, InputOption::VALUE_OPTIONAL, 'TCP host to listen on') |
|
| 49 | + ->addOption('port', null, InputOption::VALUE_OPTIONAL, 'TCP port to listen on (if not present, daemon will listen on FCGI_LISTENSOCK_FILENO)') |
|
| 50 | + ->addOption('host', null, InputOption::VALUE_OPTIONAL, 'TCP host to listen on') |
|
| 51 | 51 | ->addOption('request-limit', null, InputOption::VALUE_OPTIONAL, 'The maximum number of requests to handle before shutting down') |
| 52 | - ->addOption('memory-limit', null, InputOption::VALUE_OPTIONAL, 'The memory limit on the daemon instance before shutting down') |
|
| 53 | - ->addOption('time-limit', null, InputOption::VALUE_OPTIONAL, 'The time limit on the daemon in seconds before shutting down') |
|
| 54 | - ->addOption('driver', null, InputOption::VALUE_OPTIONAL, 'The implementation of the FastCGI protocol to use', 'userland'); |
|
| 52 | + ->addOption('memory-limit', null, InputOption::VALUE_OPTIONAL, 'The memory limit on the daemon instance before shutting down') |
|
| 53 | + ->addOption('time-limit', null, InputOption::VALUE_OPTIONAL, 'The time limit on the daemon in seconds before shutting down') |
|
| 54 | + ->addOption('driver', null, InputOption::VALUE_OPTIONAL, 'The implementation of the FastCGI protocol to use', 'userland'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | $logger = new ConsoleLogger($output); |
| 69 | 69 | |
| 70 | 70 | $requestLimit = $input->getOption('request-limit') ?: DaemonOptions::NO_LIMIT; |
| 71 | - $memoryLimit = $input->getOption('memory-limit') ?: DaemonOptions::NO_LIMIT; |
|
| 72 | - $timeLimit = $input->getOption('time-limit') ?: DaemonOptions::NO_LIMIT; |
|
| 71 | + $memoryLimit = $input->getOption('memory-limit') ?: DaemonOptions::NO_LIMIT; |
|
| 72 | + $timeLimit = $input->getOption('time-limit') ?: DaemonOptions::NO_LIMIT; |
|
| 73 | 73 | |
| 74 | 74 | return new DaemonOptions([ |
| 75 | 75 | DaemonOptions::LOGGER => $logger, |
@@ -161,6 +161,10 @@ |
||
| 161 | 161 | return false; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | + /** |
|
| 165 | + * @param resource $stream |
|
| 166 | + * @param string $boundary |
|
| 167 | + */ |
|
| 164 | 168 | private function parseMultipartFormData($stream, $boundary) { |
| 165 | 169 | $post = ""; |
| 166 | 170 | $files = []; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | $this->params[strtoupper($name)] = $value; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $this->stdin = $stdin; |
|
| 53 | + $this->stdin = $stdin; |
|
| 54 | 54 | |
| 55 | 55 | rewind($this->stdin); |
| 56 | 56 | } |
@@ -169,14 +169,14 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | while (!feof($stream)) { |
| 171 | 171 | $get_content = $field_name && !$in_header; |
| 172 | - $buffer = stream_get_line($stream, static::$buffer_size, "\r\n" . ($get_content ? '--'.$boundary : '')); |
|
| 172 | + $buffer = stream_get_line($stream, static::$buffer_size, "\r\n".($get_content ? '--'.$boundary : '')); |
|
| 173 | 173 | |
| 174 | 174 | if ($in_header && strlen($buffer) == 0) { |
| 175 | 175 | $in_header = false; |
| 176 | 176 | } else { |
| 177 | 177 | if ($get_content) { |
| 178 | 178 | if ($field_type === 'data') { |
| 179 | - $post .= (isset($post[0]) ? '&' : '') . $field_name . "=" . urlencode($buffer); |
|
| 179 | + $post .= (isset($post[0]) ? '&' : '').$field_name."=".urlencode($buffer); |
|
| 180 | 180 | } elseif ($field_type === 'file' && $filename) { |
| 181 | 181 | $tmp_path = $this->getUploadDir().'/'.substr(md5(rand().time()), 0, 16); |
| 182 | 182 | $err = file_put_contents($tmp_path, $buffer); |