v4.6.7 The version is mainly a bug fix version without downward incompatible changes.
In this version, the problem that Http\Response::end()
method always returns true
is fixed, and the default value output_buffer_size
In previous versions output_buffer_size
default value 2M
, due output_buffer_size
restrictions, if the call end
, the content needs to be sent is greater than this limit will respond to fail with an error as follows:
use Swoole\Http\Server;
use Swoole\Http\Request;
use Swoole\Http\Response;
$http = new Server('127.0.0.1', 9501);
$http->set([
'http_compression' => false,
'buffer_output_size' => 128 * 1024,
]);
$http->on('request', function (Request $request, Response $response) {
assert($response->end(str_repeat('A', 256 * 1024)) === false);
assert(swoole_last_error() === SWOOLE_ERROR_DATA_LENGTH_TOO_LARGE);
});
$http->start();
Use the above code to reproduce the error
WARNING finish (ERRNO 1203): The length of data [262144] exceeds the output buffer size[131072], please use the sendfile, chunked transfer mode or adjust the output_buffer_size
The previous solution was: use sendfile
, write
or adjust output_buffer_size
, but in this version, output_buffer_size
is increased to the maximum value of unsigned INT ( UINT_MAX
)
Since version 4.5, the use of shared memory in the Worker process has been removed, and all UnixSocket
pipes have been used instead, so there is no need to pre-allocate memory. output_buffer_size
parameter is only a limitation, and setting it to a larger parameter will not cause additional memory usage.
At the same time, it also fixes the end
that the return value of true
is always 0609e583f524d0. After an error occurs in the above code, the response is not successful, and the return value is false
Update log
The following is the complete update log:
Enhance
- Manager process and Task synchronization process support calling
Process::signal()
function (#4190) (@matyhtf)
repair
- Fix the problem that signals cannot be registered repeatedly (#4170) (@matyhtf)
- Fix the problem of compilation failure on OpenBSD/NetBSD (#4188) (#4194) (@devnexen)
- Fix the loss of onClose event in special cases when listening to writable events (#4204) (@matyhtf)
- Fix Symfony HttpClient using native curl (#4204) (@matyhtf)
- Fix the
Http\Response::end()
method always returns true (swoole/swoole-src@66fcc35) (@matyhtf) - Fix PDOException generated by PDOStatementProxy (swoole/library#104) (@twose)
Kernel
- Refactor worker buffer and add msg id logo to event data (#4163) (@matyhtf)
- Modify Request Entity Too Large log level to warning level (#4175) (@sy-records)
- Replace inet_ntoa and inet_aton functions (#4199) (@remicollet)
- Modify the default value of output_buffer_size to UINT_MAX (swoole/swoole-src@46ab345) (@matyhtf)
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。