框架升级及修复升级后的bug

This commit is contained in:
Dev
2026-10-16 18:13:09 +08:00
parent dafb0c96c0
commit 2d342bcbd7
537 changed files with 49836 additions and 40933 deletions
+9 -17
View File
@@ -41,13 +41,10 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
];
private array $defaultOptions = self::OPTIONS_DEFAULTS + [
// array|string - an array containing the username as first value, and optionally the
// password as the second one; or string like username:password - enabling NTLM auth
'auth_ntlm' => null,
'auth_ntlm' => null, // array|string - an array containing the username as first value, and optionally the
// password as the second one; or string like username:password - enabling NTLM auth
'extra' => [
'use_persistent_connections' => false,
// A list of extra curl options indexed by their corresponding CURLOPT_*
'curl' => [],
'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_*
],
];
private static array $emptyDefaults = self::OPTIONS_DEFAULTS + ['auth_ntlm' => null];
@@ -138,10 +135,11 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0;
} elseif (1.1 === (float) $options['http_version']) {
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1;
} elseif (3.0 === (float) $options['http_version'] && 'https:' === $scheme && \defined('CURL_HTTP_VERSION_3ONLY') && (\CURL_VERSION_HTTP3 & CurlClientState::$curlVersion['features']) && !self::willUseProxy($proxy, $curlopts[\CURLOPT_NOPROXY], $host)) {
// CURL_HTTP_VERSION_3 falls back to older versions since curl 7.88, which added CURL_HTTP_VERSION_3ONLY
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_3;
} elseif (\defined('CURL_VERSION_HTTP2') && (\CURL_VERSION_HTTP2 & CurlClientState::$curlVersion['features']) && ('https:' === $scheme || 2.0 === (float) $options['http_version'])) {
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0;
} elseif (\defined('CURL_VERSION_HTTP3') && (\CURL_VERSION_HTTP3 & CurlClientState::$curlVersion['features']) && 3.0 === (float) $options['http_version'] && !self::willUseProxy($proxy, $curlopts[\CURLOPT_NOPROXY], $host)) {
$curlopts[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_3;
}
$ntlmOriginKey = null;
@@ -299,10 +297,6 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
$curlopts[\CURLOPT_TIMEOUT_MS] = 1000 * $options['max_duration'];
}
if (0 < $options['max_connect_duration']) {
$curlopts[\CURLOPT_CONNECTTIMEOUT_MS] = ceil(1000 * $options['max_connect_duration']);
}
if (!empty($options['extra']['curl']) && \is_array($options['extra']['curl'])) {
$this->validateExtraCurlOptions($options['extra']['curl']);
$curlopts += $options['extra']['curl'];
@@ -327,7 +321,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
if (!$pushedResponse) {
$ch = curl_init();
$this->logger?->info(\sprintf('Request: "%s %s"', $method, $url));
$curlopts += [\CURLOPT_SHARE => ($options['extra']['use_persistent_connections'] ?? false) ? $this->multi->persistentShare : $this->multi->share];
$curlopts += [\CURLOPT_SHARE => $this->multi->share];
}
foreach ($curlopts as $opt => $value) {
@@ -396,8 +390,6 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
/**
* Wraps the request's body callback to allow it to return strings longer than curl requested.
*
* @param-immediately-invoked-callable $body
*/
private static function readRequestBody(int $length, \Closure $body, string &$buffer, bool &$eof): string
{
@@ -524,8 +516,6 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
\CURLOPT_INTERFACE => 'bindto',
\CURLOPT_TIMEOUT_MS => 'max_duration',
\CURLOPT_TIMEOUT => 'max_duration',
\CURLOPT_CONNECTTIMEOUT_MS => 'max_connect_duration',
\CURLOPT_CONNECTTIMEOUT => 'max_connect_duration',
\CURLOPT_MAXREDIRS => 'max_redirects',
\CURLOPT_POSTREDIR => 'max_redirects',
\CURLOPT_PROXY => 'proxy',
@@ -564,6 +554,8 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
\CURLOPT_URL,
\CURLOPT_FOLLOWLOCATION,
\CURLOPT_HEADER,
\CURLOPT_CONNECTTIMEOUT,
\CURLOPT_CONNECTTIMEOUT_MS,
\CURLOPT_HTTP_VERSION,
\CURLOPT_PORT,
\CURLOPT_DNS_USE_GLOBAL_CACHE,