#413 dependency update

This commit is contained in:
Roland Gruber 2025-03-14 07:58:07 +01:00
parent eba057ac98
commit 1f66c75485
10 changed files with 57 additions and 57 deletions

View file

@ -2648,17 +2648,17 @@
}, },
{ {
"name": "symfony/http-client", "name": "symfony/http-client",
"version": "v6.4.18", "version": "v6.4.19",
"version_normalized": "6.4.18.0", "version_normalized": "6.4.19.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-client.git", "url": "https://github.com/symfony/http-client.git",
"reference": "394b440934056b8d9d6ba250001458e9d7998b7f" "reference": "3294a433fc9d12ae58128174896b5b1822c28dad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-client/zipball/394b440934056b8d9d6ba250001458e9d7998b7f", "url": "https://api.github.com/repos/symfony/http-client/zipball/3294a433fc9d12ae58128174896b5b1822c28dad",
"reference": "394b440934056b8d9d6ba250001458e9d7998b7f", "reference": "3294a433fc9d12ae58128174896b5b1822c28dad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2693,7 +2693,7 @@
"symfony/process": "^5.4|^6.0|^7.0", "symfony/process": "^5.4|^6.0|^7.0",
"symfony/stopwatch": "^5.4|^6.0|^7.0" "symfony/stopwatch": "^5.4|^6.0|^7.0"
}, },
"time": "2025-01-28T15:49:13+00:00", "time": "2025-02-13T09:55:13+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -2724,7 +2724,7 @@
"http" "http"
], ],
"support": { "support": {
"source": "https://github.com/symfony/http-client/tree/v6.4.18" "source": "https://github.com/symfony/http-client/tree/v6.4.19"
}, },
"funding": [ "funding": [
{ {

View file

@ -408,9 +408,9 @@
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'symfony/http-client' => array( 'symfony/http-client' => array(
'pretty_version' => 'v6.4.18', 'pretty_version' => 'v6.4.19',
'version' => '6.4.18.0', 'version' => '6.4.19.0',
'reference' => '394b440934056b8d9d6ba250001458e9d7998b7f', 'reference' => '3294a433fc9d12ae58128174896b5b1822c28dad',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-client', 'install_path' => __DIR__ . '/../symfony/http-client',
'aliases' => array(), 'aliases' => array(),

View file

@ -237,7 +237,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
if (!\is_string($body)) { if (!\is_string($body)) {
if (\is_resource($body)) { if (\is_resource($body)) {
$curlopts[\CURLOPT_INFILE] = $body; $curlopts[\CURLOPT_READDATA] = $body;
} else { } else {
$curlopts[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) { $curlopts[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body) {
static $eof = false; static $eof = false;
@ -316,6 +316,9 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
} }
foreach ($curlopts as $opt => $value) { foreach ($curlopts as $opt => $value) {
if (\PHP_INT_SIZE === 8 && \defined('CURLOPT_INFILESIZE_LARGE') && \CURLOPT_INFILESIZE === $opt && $value >= 1 << 31) {
$opt = \CURLOPT_INFILESIZE_LARGE;
}
if (null !== $value && !curl_setopt($ch, $opt, $value) && \CURLOPT_CERTINFO !== $opt && (!\defined('CURLOPT_HEADEROPT') || \CURLOPT_HEADEROPT !== $opt)) { if (null !== $value && !curl_setopt($ch, $opt, $value) && \CURLOPT_CERTINFO !== $opt && (!\defined('CURLOPT_HEADEROPT') || \CURLOPT_HEADEROPT !== $opt)) {
$constantName = $this->findConstantName($opt); $constantName = $this->findConstantName($opt);
throw new TransportException(sprintf('Curl option "%s" is not supported.', $constantName ?? $opt)); throw new TransportException(sprintf('Curl option "%s" is not supported.', $constantName ?? $opt));
@ -472,7 +475,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
\CURLOPT_RESOLVE => 'resolve', \CURLOPT_RESOLVE => 'resolve',
\CURLOPT_NOSIGNAL => 'timeout', \CURLOPT_NOSIGNAL => 'timeout',
\CURLOPT_HTTPHEADER => 'headers', \CURLOPT_HTTPHEADER => 'headers',
\CURLOPT_INFILE => 'body', \CURLOPT_READDATA => 'body',
\CURLOPT_READFUNCTION => 'body', \CURLOPT_READFUNCTION => 'body',
\CURLOPT_INFILESIZE => 'body', \CURLOPT_INFILESIZE => 'body',
\CURLOPT_POSTFIELDS => 'body', \CURLOPT_POSTFIELDS => 'body',

View file

@ -356,9 +356,11 @@ trait HttpClientTrait
} }
}); });
$body = http_build_query($body, '', '&'); if ('' === $body = http_build_query($body, '', '&')) {
return '';
}
if ('' === $body || !$streams && !str_contains($normalizedHeaders['content-type'][0] ?? '', 'multipart/form-data')) { if (!$streams && !str_contains($normalizedHeaders['content-type'][0] ?? '', 'multipart/form-data')) {
if (!str_contains($normalizedHeaders['content-type'][0] ?? '', 'application/x-www-form-urlencoded')) { if (!str_contains($normalizedHeaders['content-type'][0] ?? '', 'application/x-www-form-urlencoded')) {
$normalizedHeaders['content-type'] = ['Content-Type: application/x-www-form-urlencoded']; $normalizedHeaders['content-type'] = ['Content-Type: application/x-www-form-urlencoded'];
} }

View file

@ -179,19 +179,17 @@ final class AmpResponse implements ResponseInterface, StreamableInterface
/** /**
* @param AmpClientState $multi * @param AmpClientState $multi
*/ */
private static function perform(ClientState $multi, ?array &$responses = null): void private static function perform(ClientState $multi, ?array $responses = null): void
{ {
if ($responses) { foreach ($responses ?? [] as $response) {
foreach ($responses as $response) { try {
try { if ($response->info['start_time']) {
if ($response->info['start_time']) { $response->info['total_time'] = microtime(true) - $response->info['start_time'];
$response->info['total_time'] = microtime(true) - $response->info['start_time']; ($response->onProgress)();
($response->onProgress)();
}
} catch (\Throwable $e) {
$multi->handlesActivity[$response->id][] = null;
$multi->handlesActivity[$response->id][] = $e;
} }
} catch (\Throwable $e) {
$multi->handlesActivity[$response->id][] = null;
$multi->handlesActivity[$response->id][] = $e;
} }
} }
} }

View file

@ -12,7 +12,6 @@
namespace Symfony\Component\HttpClient\Response; namespace Symfony\Component\HttpClient\Response;
use Symfony\Component\HttpClient\Chunk\ErrorChunk; use Symfony\Component\HttpClient\Chunk\ErrorChunk;
use Symfony\Component\HttpClient\Chunk\FirstChunk;
use Symfony\Component\HttpClient\Chunk\LastChunk; use Symfony\Component\HttpClient\Chunk\LastChunk;
use Symfony\Component\HttpClient\Exception\TransportException; use Symfony\Component\HttpClient\Exception\TransportException;
use Symfony\Contracts\HttpClient\ChunkInterface; use Symfony\Contracts\HttpClient\ChunkInterface;
@ -245,7 +244,7 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
$wrappedResponses[] = $r->response; $wrappedResponses[] = $r->response;
if ($r->stream) { if ($r->stream) {
yield from self::passthruStream($response = $r->response, $r, new FirstChunk(), $asyncMap); yield from self::passthruStream($response = $r->response, $r, $asyncMap, new LastChunk());
if (!isset($asyncMap[$response])) { if (!isset($asyncMap[$response])) {
array_pop($wrappedResponses); array_pop($wrappedResponses);
@ -276,15 +275,9 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
} }
if (!$r->passthru) { if (!$r->passthru) {
if (null !== $chunk->getError() || $chunk->isLast()) { $r->stream = (static fn () => yield $chunk)();
unset($asyncMap[$response]); yield from self::passthruStream($response, $r, $asyncMap);
} elseif (null !== $r->content && '' !== ($content = $chunk->getContent()) && \strlen($content) !== fwrite($r->content, $content)) {
$chunk = new ErrorChunk($r->offset, new TransportException(sprintf('Failed writing %d bytes to the response buffer.', \strlen($content))));
$r->info['error'] = $chunk->getError();
$r->response->cancel();
}
yield $r => $chunk;
continue; continue;
} }
@ -347,13 +340,13 @@ class AsyncResponse implements ResponseInterface, StreamableInterface
} }
$r->stream = $stream; $r->stream = $stream;
yield from self::passthruStream($response, $r, null, $asyncMap); yield from self::passthruStream($response, $r, $asyncMap);
} }
/** /**
* @param \SplObjectStorage<ResponseInterface, AsyncResponse>|null $asyncMap * @param \SplObjectStorage<ResponseInterface, AsyncResponse>|null $asyncMap
*/ */
private static function passthruStream(ResponseInterface $response, self $r, ?ChunkInterface $chunk, ?\SplObjectStorage $asyncMap): \Generator private static function passthruStream(ResponseInterface $response, self $r, ?\SplObjectStorage $asyncMap, ?ChunkInterface $chunk = null): \Generator
{ {
while (true) { while (true) {
try { try {

View file

@ -265,11 +265,11 @@ final class CurlResponse implements ResponseInterface, StreamableInterface
/** /**
* @param CurlClientState $multi * @param CurlClientState $multi
*/ */
private static function perform(ClientState $multi, ?array &$responses = null): void private static function perform(ClientState $multi, ?array $responses = null): void
{ {
if ($multi->performing) { if ($multi->performing) {
if ($responses) { if ($responses) {
$response = current($responses); $response = $responses[array_key_first($responses)];
$multi->handlesActivity[(int) $response->handle][] = null; $multi->handlesActivity[(int) $response->handle][] = null;
$multi->handlesActivity[(int) $response->handle][] = new TransportException(sprintf('Userland callback cannot use the client nor the response while processing "%s".', curl_getinfo($response->handle, \CURLINFO_EFFECTIVE_URL))); $multi->handlesActivity[(int) $response->handle][] = new TransportException(sprintf('Userland callback cannot use the client nor the response while processing "%s".', curl_getinfo($response->handle, \CURLINFO_EFFECTIVE_URL)));
} }

View file

@ -167,7 +167,7 @@ class MockResponse implements ResponseInterface, StreamableInterface
$runningResponses[0][1][$response->id] = $response; $runningResponses[0][1][$response->id] = $response;
} }
protected static function perform(ClientState $multi, array &$responses): void protected static function perform(ClientState $multi, array $responses): void
{ {
foreach ($responses as $response) { foreach ($responses as $response) {
$id = $response->id; $id = $response->id;

View file

@ -228,7 +228,7 @@ final class NativeResponse implements ResponseInterface, StreamableInterface
/** /**
* @param NativeClientState $multi * @param NativeClientState $multi
*/ */
private static function perform(ClientState $multi, ?array &$responses = null): void private static function perform(ClientState $multi, ?array $responses = null): void
{ {
foreach ($multi->openHandles as $i => [$pauseExpiry, $h, $buffer, $onProgress]) { foreach ($multi->openHandles as $i => [$pauseExpiry, $h, $buffer, $onProgress]) {
if ($pauseExpiry) { if ($pauseExpiry) {

View file

@ -92,7 +92,7 @@ trait TransportResponseTrait
/** /**
* Performs all pending non-blocking operations. * Performs all pending non-blocking operations.
*/ */
abstract protected static function perform(ClientState $multi, array &$responses): void; abstract protected static function perform(ClientState $multi, array $responses): void;
/** /**
* Waits for network activity. * Waits for network activity.
@ -150,10 +150,15 @@ trait TransportResponseTrait
$lastActivity = hrtime(true) / 1E9; $lastActivity = hrtime(true) / 1E9;
$elapsedTimeout = 0; $elapsedTimeout = 0;
if ($fromLastTimeout = 0.0 === $timeout && '-0' === (string) $timeout) { if ((0.0 === $timeout && '-0' === (string) $timeout) || 0 > $timeout) {
$timeout = null; $timeout = $timeout ? -$timeout : null;
} elseif ($fromLastTimeout = 0 > $timeout) {
$timeout = -$timeout; /** @var ClientState $multi */
foreach ($runningResponses as [$multi]) {
if (null !== $multi->lastTimeout) {
$elapsedTimeout = max($elapsedTimeout, $lastActivity - $multi->lastTimeout);
}
}
} }
while (true) { while (true) {
@ -162,8 +167,7 @@ trait TransportResponseTrait
$timeoutMin = $timeout ?? \INF; $timeoutMin = $timeout ?? \INF;
/** @var ClientState $multi */ /** @var ClientState $multi */
foreach ($runningResponses as $i => [$multi]) { foreach ($runningResponses as $i => [$multi, &$responses]) {
$responses = &$runningResponses[$i][1];
self::perform($multi, $responses); self::perform($multi, $responses);
foreach ($responses as $j => $response) { foreach ($responses as $j => $response) {
@ -171,26 +175,25 @@ trait TransportResponseTrait
$timeoutMin = min($timeoutMin, $response->timeout, 1); $timeoutMin = min($timeoutMin, $response->timeout, 1);
$chunk = false; $chunk = false;
if ($fromLastTimeout && null !== $multi->lastTimeout) {
$elapsedTimeout = hrtime(true) / 1E9 - $multi->lastTimeout;
}
if (isset($multi->handlesActivity[$j])) { if (isset($multi->handlesActivity[$j])) {
$multi->lastTimeout = null; $multi->lastTimeout = null;
$elapsedTimeout = 0;
} elseif (!isset($multi->openHandles[$j])) { } elseif (!isset($multi->openHandles[$j])) {
$hasActivity = true;
unset($responses[$j]); unset($responses[$j]);
continue; continue;
} elseif ($elapsedTimeout >= $timeoutMax) { } elseif ($elapsedTimeout >= $timeoutMax) {
$multi->handlesActivity[$j] = [new ErrorChunk($response->offset, sprintf('Idle timeout reached for "%s".', $response->getInfo('url')))]; $multi->handlesActivity[$j] = [new ErrorChunk($response->offset, sprintf('Idle timeout reached for "%s".', $response->getInfo('url')))];
$multi->lastTimeout ??= $lastActivity; $multi->lastTimeout ??= $lastActivity;
$elapsedTimeout = $timeoutMax;
} else { } else {
continue; continue;
} }
while ($multi->handlesActivity[$j] ?? false) { $lastActivity = null;
$hasActivity = true; $hasActivity = true;
$elapsedTimeout = 0;
while ($multi->handlesActivity[$j] ?? false) {
if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) { if (\is_string($chunk = array_shift($multi->handlesActivity[$j]))) {
if (null !== $response->inflate && false === $chunk = @inflate_add($response->inflate, $chunk)) { if (null !== $response->inflate && false === $chunk = @inflate_add($response->inflate, $chunk)) {
$multi->handlesActivity[$j] = [null, new TransportException(sprintf('Error while processing content unencoding for "%s".', $response->getInfo('url')))]; $multi->handlesActivity[$j] = [null, new TransportException(sprintf('Error while processing content unencoding for "%s".', $response->getInfo('url')))];
@ -227,7 +230,6 @@ trait TransportResponseTrait
} }
} elseif ($chunk instanceof ErrorChunk) { } elseif ($chunk instanceof ErrorChunk) {
unset($responses[$j]); unset($responses[$j]);
$elapsedTimeout = $timeoutMax;
} elseif ($chunk instanceof FirstChunk) { } elseif ($chunk instanceof FirstChunk) {
if ($response->logger) { if ($response->logger) {
$info = $response->getInfo(); $info = $response->getInfo();
@ -274,10 +276,12 @@ trait TransportResponseTrait
if ($chunk instanceof ErrorChunk && !$chunk->didThrow()) { if ($chunk instanceof ErrorChunk && !$chunk->didThrow()) {
// Ensure transport exceptions are always thrown // Ensure transport exceptions are always thrown
$chunk->getContent(); $chunk->getContent();
throw new \LogicException('A transport exception should have been thrown.');
} }
} }
if (!$responses) { if (!$responses) {
$hasActivity = true;
unset($runningResponses[$i]); unset($runningResponses[$i]);
} }
@ -291,7 +295,7 @@ trait TransportResponseTrait
} }
if ($hasActivity) { if ($hasActivity) {
$lastActivity = hrtime(true) / 1E9; $lastActivity ??= hrtime(true) / 1E9;
continue; continue;
} }