2
头图

v4.7.1 The version is mainly a bug fix version, without downward incompatible changes.

  • Compatible with PHP 8.1 version
  • As SWOOLE_HOOK_CURL support CURLOPT_RESOLVE options

Supports HOST:PORT:ADDRESS , [+]HOST:PORT:ADDRESS , [-]HOST:PORT:ADDRESS and multiple addresses

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);
});

Update log

The following is the complete update log:

Enhance

  • System::dnsLookup Support query /etc/hosts (#4341) (#4349) (@zmyWL) (@NathanFreeman)
  • Add boost context support for mips64 (#4358) (@dixyes)
  • SWOOLE_HOOK_CURL supports CURLOPT_RESOLVE option (swoole/library#107) (@sy-records)
  • SWOOLE_HOOK_CURL supports CURLOPT_NOPROGRESS option (swoole/library#117) (@sy-records)
  • Add boost context support for riscv64 (#4375) (@dixyes)

repair

  • Fix PHP-8.1 memory error when on shutdown (#4325) (@twose)
  • Fix the non-serializable classes of 8.1.0beta1 (#4335) (@remicollet)
  • Fix the problem that multiple coroutines fail to create directories recursively (#4337) (@NathanFreeman)
  • Fix the occasional timeout problem of native curl sending large files on the external network, and the crash problem when using the coroutine file API in CURL WRITEFUNCTION (#4360) (@matyhtf)
  • Fix the PDOStatement::bindParam() that 0611e2bb23b64a expects parameter 1 to be a string (swoole/library#116) (@sy-records)


沈唁
1.9k 声望1.2k 粉丝