Add FollowRedirects option to downloader
Introduces a FollowRedirects property to UnitDownloaderOptions and its builder, allowing control over HTTP redirect behavior. Updates UnitDownloader to use this option, following redirects when enabled and reporting progress accordingly.
This commit is contained in:
@@ -13,11 +13,17 @@ public sealed class UnitDownloaderOptionsBuilder<OutType> {
|
||||
private AsyncTransformer<ByteDocument, OutType>? _asyncTransformer;
|
||||
private string? _downloadFolder = null;
|
||||
private int _bufferSize = 80 * 1024;
|
||||
private bool _followRedirects = true;
|
||||
|
||||
public UnitDownloaderOptionsBuilder<OutType> WithTarget(DownloadTarget target) {
|
||||
_target = target;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UnitDownloaderOptionsBuilder<OutType> WithFollowRedirects(bool followRedirects) {
|
||||
_followRedirects = followRedirects;
|
||||
return this;
|
||||
}
|
||||
|
||||
public UnitDownloaderOptionsBuilder<OutType> WithClient(HttpClient client)
|
||||
{
|
||||
@@ -98,6 +104,7 @@ public sealed class UnitDownloaderOptionsBuilder<OutType> {
|
||||
Client = _client,
|
||||
FailurePredicateOptions = _failurePredicateOptionsOverride,
|
||||
SkipPredicateOptions = _skipPredicateOptionsOverride,
|
||||
FollowRedirects = _followRedirects,
|
||||
FragmentOptions = _fragmentOptions,
|
||||
AsyncTransformer = _asyncTransformer,
|
||||
DownloadFolder = _downloadFolder,
|
||||
|
||||
Reference in New Issue
Block a user