V4.6.4 is primarily a Bug fix with no downward incompatible changes.

The Swoole\Coroutine\Http\get, Swoole\Coroutine\Http\post and Swoole\Coroutine\Http\request functions have been added. This operation is for the convenience of Coroutine\Http\Client

use function Swoole\Coroutine\go;
use function Swoole\Coroutine\run;
use function Swoole\Coroutine\Http\get;
use function Swoole\Coroutine\Http\post;
use function Swoole\Coroutine\Http\request;

run(function () {
    go(function () {
        $data = get('http://httpbin.org/get?hello=world');
        $body = json_decode($data->getBody());
        assert($body->headers->Host === 'httpbin.org');
        assert($body->args->hello === 'world');
    });
    go(function () {
        $random_data = base64_encode(random_bytes(128));
        $data = post('http://httpbin.org/post?hello=world'['random_data'= >$random_data]);
        $body = json_decode($data->getBody());
        assert($body->headers->Host === 'httpbin.org');
        assert($body->args->hello === 'world');
        assert($body->form->random_data === $random_data);
    });
});
Copy the code

Update log

Here’s the full update log:

The new API

  • Added Coroutine\Http::request, Coroutine\Http::post, Coroutine\Http::get (swoole/library#97) (@matyhtf)

To enhance

  • Support for ARM 64 builds (#4057)
  • Support for setting open_HTTP_protocol (#4063) in Swoole TCP server (@matyhtf)
  • Support SSL client only set certificate (91704AC) (@matyhtf)
  • Support for tcp_DEFER_ACCEPT option (#4049) (@devnexen)

repair

  • Fixed lack of proxy authorization when using Coroutine\Http\Client (EDC0552) (@matyhtf)
  • Fix Swoole\Table memory allocation problem (3e7770f) (@matyhtf)
  • Fixed crash (630536d) when Coroutine\Http2\Client connects concurrently (@matyhtf)
  • Fix enable_SSL_ENCRYPT problem in DTLS (842733b) (@matyhtf)
  • Fix Coroutine\Barrier memory leak (swoole/library#94) (@appla) (@fmis)
  • Fixed offset errors caused by CURLOPT_PORT and CURLOPT_URL order (swoole/library#96) (@sy-records)
  • repairTable::get($key, $field)Error when field type is float (08ea20c) (@matyhtf)
  • Fix Swoole\Table memory leak (D78CA8C) (@matyhtf)

Swoole V4.6.4 released, bug-fixed