2
2
* Generated by build-library.php, Please DO NOT modify!
3
3
*/
4
4
5
- /* $Id: e07037baef45ea64d334257e203fe2ca82914c93 */
5
+ /* $Id: 05b8161677541803bf1644f9a57057863c67937b */
6
6
7
7
static const char * swoole_library_source_constants =
8
8
"\n"
@@ -19,7 +19,8 @@ static const char* swoole_library_source_constants =
19
19
"define('SWOOLE_LIBRARY', true);\n"
20
20
"\n"
21
21
"!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" ;
23
24
24
25
static const char * swoole_library_source_std_exec =
25
26
"\n"
@@ -305,6 +306,10 @@ static const char* swoole_library_source_core_constant =
305
306
"\n"
306
307
" public const OPTION_WEBSOCKET_MASK = 'websocket_mask';\n"
307
308
"\n"
309
+ " public const OPTION_HTTP_COMPRESSION = 'http_compression';\n"
310
+ "\n"
311
+ " public const OPTION_BODY_DECOMPRESSION = 'body_decompression';\n"
312
+ "\n"
308
313
" public const OPTION_WEBSOCKET_COMPRESSION = 'websocket_compression';\n"
309
314
"\n"
310
315
" public const OPTION_HTTP_PARSE_COOKIE = 'http_parse_cookie';\n"
@@ -313,8 +318,6 @@ static const char* swoole_library_source_core_constant =
313
318
"\n"
314
319
" public const OPTION_HTTP_PARSE_FILES = 'http_parse_files';\n"
315
320
"\n"
316
- " public const OPTION_HTTP_COMPRESSION = 'http_compression';\n"
317
- "\n"
318
321
" public const OPTION_HTTP_COMPRESSION_LEVEL = 'http_compression_level';\n"
319
322
"\n"
320
323
" 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 =
3005
3008
" return $this->__object->setAttribute($attribute, $value);\n"
3006
3009
" }\n"
3007
3010
"\n"
3008
- " public function setFetchMode(int $mode, $classNameObject = null, array $ctorarfg = [] ): bool\n"
3011
+ " public function setFetchMode(int $mode, ...$args ): bool\n"
3009
3012
" {\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"
3015
3015
" }\n"
3016
3016
"\n"
3017
3017
" 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 =
3587
3587
"\n"
3588
3588
" private $cookieJar = '';\n"
3589
3589
"\n"
3590
+ " private $resolve = [];\n"
3591
+ "\n"
3590
3592
" public function __construct(string $url = '')\n"
3591
3593
" {\n"
3592
3594
" if ($url) {\n"
@@ -3673,7 +3675,15 @@ static const char* swoole_library_source_core_curl_handler =
3673
3675
" if ($urlInfo === null) {\n"
3674
3676
" $urlInfo = $this->urlInfo;\n"
3675
3677
" }\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"
3677
3687
" }\n"
3678
3688
"\n"
3679
3689
" private function getUrl(): string\n"
@@ -3761,7 +3771,7 @@ static const char* swoole_library_source_core_curl_handler =
3761
3771
" private function setError($code, $msg = ''): void\n"
3762
3772
" {\n"
3763
3773
" $this->errCode = $code;\n"
3764
- " $this->errMsg = $msg ? $msg : curl_strerror($code);\n"
3774
+ " $this->errMsg = $msg ?: curl_strerror($code);\n"
3765
3775
" }\n"
3766
3776
"\n"
3767
3777
" private function hasHeader(string $headerName): bool\n"
@@ -3870,6 +3880,25 @@ static const char* swoole_library_source_core_curl_handler =
3870
3880
" $this->nobody = boolval($value);\n"
3871
3881
" $this->method = 'HEAD';\n"
3872
3882
" 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"
3873
3902
" case CURLOPT_IPRESOLVE:\n"
3874
3903
" if ($value !== CURL_IPRESOLVE_WHATEVER and $value !== CURL_IPRESOLVE_V4) {\n"
3875
3904
" throw new Swoole\\Curl\\Exception(\n"
@@ -4260,6 +4289,10 @@ static const char* swoole_library_source_core_curl_handler =
4260
4289
" $this->info['redirect_time'] = microtime(true) - $redirectBeginTime;\n"
4261
4290
" }\n"
4262
4291
"\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"
4263
4296
" $headerContent = '';\n"
4264
4297
" if ($client->headers) {\n"
4265
4298
" $cb = $this->headerFunction;\n"
@@ -7118,6 +7151,8 @@ static const char* swoole_library_source_ext_curl =
7118
7151
" return $info['redirect_time'];\n"
7119
7152
" case CURLINFO_HEADER_SIZE:\n"
7120
7153
" return $info['header_size'];\n"
7154
+ " case CURLINFO_PRIMARY_IP:\n"
7155
+ " return $info['primary_ip'];\n"
7121
7156
" case CURLINFO_PRIVATE:\n"
7122
7157
" return $info['private'];\n"
7123
7158
" default:\n"
0 commit comments