关于php:Swoole-v463-版本发布祝大家-2021-春节快乐

8次阅读

共计 1481 个字符,预计需要花费 4 分钟才能阅读完成。

牛年春节在即,Swoole 也迎来了 2020 年(农历)的最初一个版本。

在此感激为 Swoole 的代码、文档以及生态方面做出奉献的小伙伴,也期待有更多的小伙伴退出 \~

祝大家 2021 牛年春节快乐,Bug 全走开。

v4.6.3 版本次要是一个 Bug 修复版本,没有向下不兼容改变。

  • 新增了 Swoole\Coroutine\goSwoole\Coroutine\defer 函数,这个操作次要避免用户手动敞开了短名,去复制粘贴运行示例代码时会报错的问题
use function Swoole\Coroutine\go;
use function Swoole\Coroutine\run;
use function Swoole\Coroutine\defer;

run(function () {defer(function () {echo "co1 end\n";});
    sleep(1);
    go(function () {usleep(100000);
        defer(function () {echo "co2 end\n";});
        echo "co2\n";
    });
    echo "co1\n";
});
  • 如果用户晓得 Content-Length 的长度,在此版本中也容许用户自行设置 Content-Length 的 HTTP 头。
    用户设置的 Content-Length HTTP 头会笼罩底层计算的 Content-Length
use Swoole\Http\Server;
use Swoole\Http\Request;
use Swoole\Http\Response;

$http = new Server('0.0.0.0', 9501);

$http->on('Request', function (Request $request, Response $response) {
    $msg = 'Hello, Swoole';
    $response->header('Content-Length', strlen($msg));
    $response->end($msg);
});

$http->start();

更新日志

上面是残缺的更新日志:

新增 API

  • 新增 Swoole\Coroutine\go 函数 (swoole/library@82f63be) (@matyhtf)
  • 新增 Swoole\Coroutine\defer 函数 (swoole/library@92fd0de) (@matyhtf)

加强

  • 为 HTTP 服务器增加 compression\_min\_length 选项 (#4033) (@matyhtf)
  • 容许在应用层设置 Content-Length HTTP 头 (#4041) (@doubaokun)

修复

  • 修复程序达到文件关上限度时的 coredump (swoole/swoole-src@709813f) (@matyhtf)
  • 修复 JIT 被禁用问题 (#4029) (@twose)
  • 修复 Response::create() 参数谬误问题 (swoole/swoole-src@a630b5b) (@matyhtf)
  • 修复 ARM 平台下投递 task 时 task\_worker\_id 误报 (#4040) (@doubaokun)
  • 修复 PHP8 开启 native curl hook 时的 coredump (#4042)(#4045) (@Yurunsoft) (@matyhtf)
  • 修复 fatal error 时 shutdown 阶段的内存越界谬误 (#4050) (@matyhtf)

内核

  • 优化 ssl\_connect/ssl\_shutdown (#4030) (@matyhtf)
  • 产生 fatal error 时间接退出过程 (#4053) (@matyhtf)

正文完
 0