框架升级及修复升级后的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 -7
View File
@@ -80,6 +80,9 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
if (str_starts_with($options['bindto'], 'host!')) {
$options['bindto'] = substr($options['bindto'], 5);
}
if ((\PHP_VERSION_ID < 80223 || 80300 <= \PHP_VERSION_ID && 80311 < \PHP_VERSION_ID) && '\\' === \DIRECTORY_SEPARATOR && '[' === $options['bindto'][0]) {
$options['bindto'] = preg_replace('{^\[[^\]]++\]}', '[$0]', $options['bindto']);
}
}
$hasContentLength = isset($options['normalized_headers']['content-length']);
@@ -225,10 +228,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
'curl_verify_ssl_peer' => $options['verify_peer'],
'curl_verify_ssl_host' => $options['verify_host'],
'auto_decode' => false, // Disable dechunk filter, it's incompatible with stream_select()
// PHP's stream context "timeout" is a read timeout, not a connect-only deadline; on this backend
// "max_connect_duration" is therefore best-effort and also caps subsequent socket reads at that
// duration. The curl and amp backends enforce the connect phase precisely.
'timeout' => 0 < $options['max_connect_duration'] ? min($options['timeout'], $options['max_connect_duration']) : $options['timeout'],
'timeout' => $options['timeout'],
'follow_location' => false, // We follow redirects ourselves - the native logic is too limited
],
'ssl' => array_filter([
@@ -330,8 +330,6 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
/**
* Resolves the IP of the host using the local DNS cache if possible.
*
* @param-immediately-invoked-callable $onProgress
*/
private static function dnsResolve(string $host, NativeClientState $multi, array &$info, ?\Closure $onProgress): string
{
@@ -434,7 +432,11 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
$redirectHeaders['no_auth'] = array_filter($redirectHeaders['no_auth'], $filterContentHeaders);
$redirectHeaders['with_auth'] = array_filter($redirectHeaders['with_auth'], $filterContentHeaders);
stream_context_set_options($context, ['http' => $options]);
if (\PHP_VERSION_ID >= 80300) {
stream_context_set_options($context, ['http' => $options]);
} else {
stream_context_set_option($context, ['http' => $options]);
}
}
}