finally { $info['download_content_length'
] =
$info['size_download'
];
} self::
stopLoop();
} private static function followRedirects(Request
$originRequest, AmpClientState
$multi, array &
$info, array &
$headers, CancellationTokenSource
$canceller, array
$options, \Closure
$onProgress, &
$handle, ?LoggerInterface
$logger, Promise &
$pause): \Generator
{ yield $pause;
$originRequest->
setBody(new AmpBody($options['body'
],
$info,
$onProgress));
$response =
yield $multi->
request($options,
$originRequest,
$canceller->
getToken(),
$info,
$onProgress,
$handle);
$previousUrl = null;
while (true
) { self::
addResponseHeaders($response,
$info,
$headers);
$status =
$response->
getStatus();
if (!\
in_array($status,
[301, 302, 303, 307, 308
], true
) || null ===
$location =
$response->
getHeader('location'
)) { return $response;
}