框架升级及修复升级后的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
+16 -14
View File
@@ -72,7 +72,6 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
$this->info['http_method'] = $method;
$this->info['user_data'] = $options['user_data'] ?? null;
$this->info['max_duration'] = $options['max_duration'] ?? null;
$this->info['max_connect_duration'] = $options['max_connect_duration'] ?? null;
$this->info['start_time'] ??= microtime(true);
$this->info['original_url'] = $originalUrl ?? $this->info['url'] ?? curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL);
$info = &$this->info;
@@ -147,20 +146,19 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
});
}
curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int {
if ('H' === (curl_getinfo($ch, \CURLINFO_PRIVATE)[0] ?? null)) {
$multi->handlesActivity[$id][] = null;
$multi->handlesActivity[$id][] = new TransportException(\sprintf('Unsupported protocol for "%s"', curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL)));
$checkProtocol = true;
curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id, &$checkProtocol): int {
if ($checkProtocol) {
if ('H' === (curl_getinfo($ch, \CURLINFO_PRIVATE)[0] ?? null)) {
$multi->handlesActivity[$id][] = null;
$multi->handlesActivity[$id][] = new TransportException(\sprintf('Unsupported protocol for "%s"', curl_getinfo($ch, \CURLINFO_EFFECTIVE_URL)));
return 0;
return 0;
}
$checkProtocol = false;
}
curl_setopt($ch, \CURLOPT_WRITEFUNCTION, static function ($ch, string $data) use ($multi, $id): int {
$multi->handlesActivity[$id][] = $data;
return \strlen($data);
});
$multi->handlesActivity[$id][] = $data;
return \strlen($data);
@@ -367,6 +365,12 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
}
}
// curl_multi_select() passes the timeout to curl as milliseconds in a signed
// 32-bit int, so it rejects anything above 2147483.647 seconds: a warning on
// PHP < 8.5, a ValueError since. A large timeout or max_duration reaches that.
// The lower bound is clamped by the caller, in TransportResponseTrait.
$timeout = min($timeout, 2147483.647);
if (0 !== $selected = curl_multi_select($multi->handle, $timeout)) {
return $selected;
}
@@ -380,8 +384,6 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
/**
* Parses header lines as curl yields them to us.
*
* @param-immediately-invoked-callable $resolveRedirect
*/
private static function parseHeaderLine($ch, string $data, array &$info, array &$headers, ?array $options, CurlClientState $multi, int $id, ?string &$location, ?callable $resolveRedirect, ?LoggerInterface $logger): int
{