18910140161

Swoole v4.7.1 版本发布,Bug 修复版本

顺晟科技

2021-08-26 12:43:10

245

v4.7.1 版本主要是一个 Bug 修复版本,没有向下不兼容改动。

兼容了 PHP 8.1 版本为SWOOLE_HOOK_CURL支持了CURLOPT_RESOLVE选项

支持了形如HOST:PORT:ADDRESS[+]HOST:PORT:ADDRESS[-]HOST:PORT:ADDRESS和多地址的格式

use Swoole\Coroutine;
use Swoole\Runtime;

Runtime::enableCoroutine(SWOOLE_HOOK_CURL);
Coroutine\run(function () {
    $host = 'httpbin.org';
    $url = 'https://httpbin.org/get';
    $ip = Coroutine::gethostbyname($host);
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_RESOLVE, ["{$host}:443:127.0.0.1", "{$host}:443:{$ip}"]);

    $data = curl_exec($ch);
    $httpPrimaryIp = curl_getinfo($ch, CURLINFO_PRIMARY_IP);
    $body = json_decode($data, true);
    assert($body['headers']['Host'] === 'httpbin.org');
    assert($body['url'] === $url);
    assert($ip === $httpPrimaryIp);
});

更新日志

下面是完整的更新日志:

增强

System::dnsLookup 支持查询 /etc/hosts (#4341) (#4349) (@zmyWL) (@NathanFreeman)增加对 mips64 的 boost context 支持 (#4358) (@dixyes)SWOOLE_HOOK_CURL 支持 CURLOPT_RESOLVE 选项 (swoole/library#107) (@sy-records)SWOOLE_HOOK_CURL 支持 CURLOPT_NOPROGRESS 选项 (swoole/library#117) (@sy-records)增加对 riscv64 的 boost context 支持 (#4375) (@dixyes)

修复

修复 PHP-8.1 在 on shutdown 时产生的内存错误 (#4325) (@twose)修复 8.1.0beta1 的不可序列化类 (#4335) (@remicollet)修复多个协程递归创建目录失败的问题 (#4337) (@NathanFreeman)修复 native curl 在外网发送大文件偶发超时的问题,以及在 CURL WRITEFUNCTION 中使用协程文件 API 出现 crash 的问题 (#4360) (@matyhtf)修复 PDOStatement::bindParam() 期望参数 1 为字符串的问题 (swoole/library#116) (@sy-records)

相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航