Skip to content

Commit db6deb0

Browse files
authored
Update version for Swoole 4.7.0 (swoole#4321)
1 parent 3f2e960 commit db6deb0

File tree

7 files changed

+119
-31
lines changed

7 files changed

+119
-31
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PROJECT(libswoole)
22

33
ENABLE_LANGUAGE(ASM)
4-
set(SWOOLE_VERSION 4.7.0-dev)
4+
set(SWOOLE_VERSION 4.7.0)
55

66
set(CMAKE_CXX_STANDARD 11)
77
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")

ext-src/php_swoole.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,8 @@ PHP_MINIT_FUNCTION(swoole) {
588588
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_DNSLOOKUP_DUPLICATE_REQUEST", SW_ERROR_DNSLOOKUP_DUPLICATE_REQUEST);
589589
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_DNSLOOKUP_RESOLVE_FAILED", SW_ERROR_DNSLOOKUP_RESOLVE_FAILED);
590590
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_DNSLOOKUP_RESOLVE_TIMEOUT", SW_ERROR_DNSLOOKUP_RESOLVE_TIMEOUT);
591+
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_DNSLOOKUP_UNSUPPORTED", SW_ERROR_DNSLOOKUP_UNSUPPORTED);
592+
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_DNSLOOKUP_NO_SERVER", SW_ERROR_DNSLOOKUP_NO_SERVER);
591593
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_BAD_IPV6_ADDRESS", SW_ERROR_BAD_IPV6_ADDRESS);
592594
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_UNREGISTERED_SIGNAL", SW_ERROR_UNREGISTERED_SIGNAL);
593595
SW_REGISTER_LONG_CONSTANT("SWOOLE_ERROR_EVENT_SOCKET_REMOVED", SW_ERROR_EVENT_SOCKET_REMOVED);
@@ -703,6 +705,7 @@ PHP_MINIT_FUNCTION(swoole) {
703705
SW_REGISTER_LONG_CONSTANT("SWOOLE_TRACE_CO_HTTP_SERVER", SW_TRACE_CO_HTTP_SERVER);
704706
SW_REGISTER_LONG_CONSTANT("SWOOLE_TRACE_TABLE", SW_TRACE_TABLE);
705707
SW_REGISTER_LONG_CONSTANT("SWOOLE_TRACE_CO_CURL", SW_TRACE_CO_CURL);
708+
SW_REGISTER_LONG_CONSTANT("SWOOLE_TRACE_CARES", SW_TRACE_CARES);
706709
SW_REGISTER_LONG_CONSTANT("SWOOLE_TRACE_ALL", SW_TRACE_ALL);
707710

708711
/**

ext-src/php_swoole_library.h

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Generated by build-library.php, Please DO NOT modify!
33
*/
44

5-
/* $Id: e07037baef45ea64d334257e203fe2ca82914c93 */
5+
/* $Id: 05b8161677541803bf1644f9a57057863c67937b */
66

77
static const char* swoole_library_source_constants =
88
"\n"
@@ -19,7 +19,8 @@ static const char* swoole_library_source_constants =
1919
"define('SWOOLE_LIBRARY', true);\n"
2020
"\n"
2121
"!defined('CURLOPT_HEADEROPT') && define('CURLOPT_HEADEROPT', 229);\n"
22-
"!defined('CURLOPT_PROXYHEADER') && define('CURLOPT_PROXYHEADER', 10228);\n";
22+
"!defined('CURLOPT_PROXYHEADER') && define('CURLOPT_PROXYHEADER', 10228);\n"
23+
"!defined('CURLOPT_RESOLVE') && define('CURLOPT_RESOLVE', 10203);\n";
2324

2425
static const char* swoole_library_source_std_exec =
2526
"\n"
@@ -305,6 +306,10 @@ static const char* swoole_library_source_core_constant =
305306
"\n"
306307
" public const OPTION_WEBSOCKET_MASK = 'websocket_mask';\n"
307308
"\n"
309+
" public const OPTION_HTTP_COMPRESSION = 'http_compression';\n"
310+
"\n"
311+
" public const OPTION_BODY_DECOMPRESSION = 'body_decompression';\n"
312+
"\n"
308313
" public const OPTION_WEBSOCKET_COMPRESSION = 'websocket_compression';\n"
309314
"\n"
310315
" public const OPTION_HTTP_PARSE_COOKIE = 'http_parse_cookie';\n"
@@ -313,8 +318,6 @@ static const char* swoole_library_source_core_constant =
313318
"\n"
314319
" public const OPTION_HTTP_PARSE_FILES = 'http_parse_files';\n"
315320
"\n"
316-
" public const OPTION_HTTP_COMPRESSION = 'http_compression';\n"
317-
"\n"
318321
" public const OPTION_HTTP_COMPRESSION_LEVEL = 'http_compression_level';\n"
319322
"\n"
320323
" public const OPTION_HTTP_GZIP_LEVEL = 'http_gzip_level';\n"
@@ -3005,13 +3008,10 @@ static const char* swoole_library_source_core_database_pdo_statement_proxy =
30053008
" return $this->__object->setAttribute($attribute, $value);\n"
30063009
" }\n"
30073010
"\n"
3008-
" public function setFetchMode(int $mode, $classNameObject = null, array $ctorarfg = []): bool\n"
3011+
" public function setFetchMode(int $mode, ...$args): bool\n"
30093012
" {\n"
3010-
" $this->setFetchModeContext = [$mode, $classNameObject, $ctorarfg];\n"
3011-
" if (!isset($classNameObject)) {\n"
3012-
" return $this->__object->setFetchMode($mode);\n"
3013-
" }\n"
3014-
" return $this->__object->setFetchMode($mode, $classNameObject, $ctorarfg);\n"
3013+
" $this->setFetchModeContext = func_get_args();\n"
3014+
" return $this->__object->setFetchMode(...$this->setFetchModeContext);\n"
30153015
" }\n"
30163016
"\n"
30173017
" public function bindParam($parameter, &$variable, $data_type = PDO::PARAM_STR, $length = null, $driver_options = null): bool\n"
@@ -3587,6 +3587,8 @@ static const char* swoole_library_source_core_curl_handler =
35873587
"\n"
35883588
" private $cookieJar = '';\n"
35893589
"\n"
3590+
" private $resolve = [];\n"
3591+
"\n"
35903592
" public function __construct(string $url = '')\n"
35913593
" {\n"
35923594
" if ($url) {\n"
@@ -3673,7 +3675,15 @@ static const char* swoole_library_source_core_curl_handler =
36733675
" if ($urlInfo === null) {\n"
36743676
" $urlInfo = $this->urlInfo;\n"
36753677
" }\n"
3676-
" $this->client = new Client($urlInfo['host'], $urlInfo['port'], $urlInfo['scheme'] === 'https');\n"
3678+
" $host = $urlInfo['host'];\n"
3679+
" $port = $urlInfo['port'];\n"
3680+
" if (isset($this->resolve[$host])) {\n"
3681+
" if (!$this->hasHeader('Host')) {\n"
3682+
" $this->setHeader('Host', $host);\n"
3683+
" }\n"
3684+
" $this->urlInfo['host'] = $host = $this->resolve[$host][$port] ?? null ?: $host;\n"
3685+
" }\n"
3686+
" $this->client = new Client($host, $port, $urlInfo['scheme'] === 'https');\n"
36773687
" }\n"
36783688
"\n"
36793689
" private function getUrl(): string\n"
@@ -3761,7 +3771,7 @@ static const char* swoole_library_source_core_curl_handler =
37613771
" private function setError($code, $msg = ''): void\n"
37623772
" {\n"
37633773
" $this->errCode = $code;\n"
3764-
" $this->errMsg = $msg ? $msg : curl_strerror($code);\n"
3774+
" $this->errMsg = $msg ?: curl_strerror($code);\n"
37653775
" }\n"
37663776
"\n"
37673777
" private function hasHeader(string $headerName): bool\n"
@@ -3870,6 +3880,25 @@ static const char* swoole_library_source_core_curl_handler =
38703880
" $this->nobody = boolval($value);\n"
38713881
" $this->method = 'HEAD';\n"
38723882
" break;\n"
3883+
" case CURLOPT_RESOLVE:\n"
3884+
" foreach ((array) $value as $resolve) {\n"
3885+
" $flag = substr($resolve, 0, 1);\n"
3886+
" if ($flag === '+' || $flag === '-') {\n"
3887+
" // TODO: [+]HOST:PORT:ADDRESS\n"
3888+
" $resolve = substr($resolve, 1);\n"
3889+
" }\n"
3890+
" $tmpResolve = explode(':', $resolve, 3);\n"
3891+
" $host = $tmpResolve[0] ?? '';\n"
3892+
" $port = $tmpResolve[1] ?? 0;\n"
3893+
" $ip = $tmpResolve[2] ?? '';\n"
3894+
" if ($flag === '-') {\n"
3895+
" unset($this->resolve[$host][$port]);\n"
3896+
" } else {\n"
3897+
" // TODO: HOST:PORT:ADDRESS[,ADDRESS]...\n"
3898+
" $this->resolve[$host][$port] = explode(',', $ip)[0];\n"
3899+
" }\n"
3900+
" }\n"
3901+
" break;\n"
38733902
" case CURLOPT_IPRESOLVE:\n"
38743903
" if ($value !== CURL_IPRESOLVE_WHATEVER and $value !== CURL_IPRESOLVE_V4) {\n"
38753904
" throw new Swoole\\Curl\\Exception(\n"
@@ -4260,6 +4289,10 @@ static const char* swoole_library_source_core_curl_handler =
42604289
" $this->info['redirect_time'] = microtime(true) - $redirectBeginTime;\n"
42614290
" }\n"
42624291
"\n"
4292+
" if (filter_var($this->urlInfo['host'], FILTER_VALIDATE_IP)) {\n"
4293+
" $this->info['primary_ip'] = $this->urlInfo['host'];\n"
4294+
" }\n"
4295+
"\n"
42634296
" $headerContent = '';\n"
42644297
" if ($client->headers) {\n"
42654298
" $cb = $this->headerFunction;\n"
@@ -7118,6 +7151,8 @@ static const char* swoole_library_source_ext_curl =
71187151
" return $info['redirect_time'];\n"
71197152
" case CURLINFO_HEADER_SIZE:\n"
71207153
" return $info['header_size'];\n"
7154+
" case CURLINFO_PRIMARY_IP:\n"
7155+
" return $info['primary_ip'];\n"
71217156
" case CURLINFO_PRIVATE:\n"
71227157
" return $info['private'];\n"
71237158
" default:\n"

include/swoole_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#define SWOOLE_MAJOR_VERSION 4
2222
#define SWOOLE_MINOR_VERSION 7
2323
#define SWOOLE_RELEASE_VERSION 0
24-
#define SWOOLE_EXTRA_VERSION "dev"
25-
#define SWOOLE_VERSION "4.7.0-dev"
24+
#define SWOOLE_EXTRA_VERSION ""
25+
#define SWOOLE_VERSION "4.7.0"
2626
#define SWOOLE_VERSION_ID 40700
2727
#define SWOOLE_API_VERSION_ID 0x202107a
2828

0 commit comments

Comments
 (0)