Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

View File

@ -0,0 +1,29 @@
--TEST--
swoole_http2_client: get
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--FILE--
<?php
require_once __DIR__ . '/../include/bootstrap.php';
require_once __DIR__ . '/../include/swoole.inc';
swoole_async_dns_lookup("www.jd.com", function ($domain, $ip)
{
$client = new Swoole\Http2\Client($ip, 443, true);
$array = array(
"host" => "www.jd.com",
"accept-encoding" => "gzip, deflate",
'accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'accept-language' => 'zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4,ja;q=0.2',
'user-agent' => 'Mozilla/5.0 (X11; Linux x86_64) Chrome/58.0.3026.3 Safari/537.36',
);
$client->setHeaders($array);
$client->get("/", function ($o) use ($client)
{
assert($o->statusCode == 200);
assert(strlen($o->body) > 1024);
$client->close();
});
});
swoole_event::wait();
?>
--EXPECT--

View File

@ -0,0 +1,28 @@
--TEST--
headers: http2 auto to lower
--SKIPIF--
<?php require __DIR__ . '/../include/skipif.inc'; ?>
--FILE--
<?php
require_once __DIR__ . '/../include/bootstrap.php';
$domain = 'www.swoole.com';
$client = new Swoole\Http2\Client($domain, 443, true);
$client->set([
'timeout' => 5,
'ssl_host_name' => $domain
]);
// auto to-lower
$client->setHeaders([
'Host' => $domain,
'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36',
'Accept' => 'text/html,application/xhtml+xml,application/xml',
'Accept-Encoding' => 'gzip'
]);
$client->get('/', function (Swoole\Http2\Response $response) use ($client) {
echo $response->statusCode;
$client->close();
});
swoole_event_wait();
?>
--EXPECT--
200