Skip to content

Error when server not support download in range #119

@kyuranger

Description

@kyuranger

I am a beginner and I want to create a sample project to test.

Here is the URL(but the server not support range download):
https://cdn.pixabay.com/vimeo/576083058/Hello%20-%2081605.mp4?width=1920&hash=e6f56273dcd2f28fd1a9fe6e77f66d7e157b33f6&download=1

And here is my code:

DownloadService Downloader;
var downloadOpt = new DownloadConfiguration()
{
    // usually, hosts support max to 8000 bytes, default values is 8000
    BufferBlockSize = 8000,
    // file parts to download, default value is 1
    ChunkCount = 1,
    // download speed limited to 2MB/s, default values is zero or unlimited
    MaximumBytesPerSecond = 5,
    // the maximum number of times to fail
    MaxTryAgainOnFailover = 5,
    // download parts of file as parallel or not. Default value is false
    ParallelDownload = false,
    // number of parallel downloads. The default value is the same as the chunk count
    ParallelCount = 1,
    // timeout (millisecond) per stream block reader, default values is 1000
    Timeout = 1000,
    // set true if you want to download just a specific range of bytes of a large file
    RangeDownload = false,
    // floor offset of download range of a large file
    RangeLow = 0,
    // ceiling offset of download range of a large file
    RangeHigh = 0,
    // clear package chunks data when download completed with failure, default value is false
    ClearPackageOnCompletionWithFailure = true,
    CheckDiskSizeBeforeDownload = true,
    ReserveStorageSpaceBeforeStartingDownload = true,                
};
Downloader = new DownloadService(downloadOpt);
Downloader.Package.IsSupportDownloadInRange = false;
Downloader.DownloadFileCompleted += DownloadCompleted;
Downloader.DownloadProgressChanged += DownloadProgressChanged;
Downloader.ChunkDownloadProgressChanged += ChunkDownloadProgressChanged;
Downloader.DownloadStarted += DownloadStarted;
DirectoryInfo DI = new DirectoryInfo(@"C:\downloads\");
Downloader.DownloadFileTaskAsync("https://cdn.pixabay.com/vimeo/576083058/Hello%20-%2081605.mp4?width=1920&hash=e6f56273dcd2f28fd1a9fe6e77f66d7e157b33f6&download=1", DI);

However, even I set the RangeDownload to false, ChunkCount to 1, ParallelDownload to false, ParallelCount to 1 and Package.IsSupportDownloadInRange to false. The DownloadCompleted event still report the error "The downloader cannot continue downloading because the network or server failed to download in range." and can not download the file.

What's wrong with my code? Thank you.

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions