Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when server not support download in range #119

Closed
kyuranger opened this issue Nov 23, 2022 · 10 comments
Closed

Error when server not support download in range #119

kyuranger opened this issue Nov 23, 2022 · 10 comments
Assignees
Labels
question Further information is requested
Projects

Comments

@kyuranger
Copy link

kyuranger commented Nov 23, 2022

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.

@bezzad
Copy link
Owner

bezzad commented Nov 24, 2022

The value of the MaximumBytesPerSecond is so low and not reachable speed to the server. Please set it to zero and test it again.

@bezzad bezzad self-assigned this Nov 24, 2022
@bezzad bezzad added the question Further information is requested label Nov 24, 2022
@kyuranger
Copy link
Author

The value of the MaximumBytesPerSecond is so low and not reachable speed to the server. Please set it to zero and test it again.

All right, I just want to test download and I cannot find a file large enough, so I have to do it like this.

@bezzad
Copy link
Owner

bezzad commented Nov 24, 2022

To test the download you can use your own file API like the Downloader.DummyHttpServer project. Which can provide any size of file to download. For a usage sample, please see the Downloader.Sample project which executes the API server before downloading and creates the download links in DownloadList.json.

Also, you can use the below web server to provide large-size files:
File Example

@kyuranger
Copy link
Author

To test the download you can use your own file API like the Downloader.DummyHttpServer project. Which can provide any size of file to download. For a usage sample, please see the Downloader.Sample project which executes the API server before downloading and creates the download links in DownloadList.json.

Also, you can user the below web server to provide large size files: File Example

Thank you so much. I consider it should post the https://file-examples.com/ in the project home page. This would help so many people to test their sample project.

@kyuranger kyuranger reopened this Nov 30, 2022
@kyuranger
Copy link
Author

I am afraid for reopening this issue again. I have been busy and haven't developed for a long time. Now I tried to modify the MaximumBytesPerSecond from 1 to 1024 * 1024 * 2. However, the error "The downloader cannot continue downloading because the network or server failed to download in range." still throws in DownloadFileCompleted event and cannot download the file successfully.

@bezzad
Copy link
Owner

bezzad commented Dec 4, 2022

@kyuranger Take it easy and make sure you can open it again whenever you have a problem.
I will check it and answer here. it takes a few days because now I'm busy.

@kyuranger
Copy link
Author

Thank you very much for your hard work

@bezzad bezzad pinned this issue Jan 24, 2023
@sgf

This comment was marked as outdated.

@bezzad
Copy link
Owner

bezzad commented Jul 19, 2023

@sgf we can't realize the main of your issue with this data. Please give more info and the URL and configs.

@sgf
Copy link

sgf commented Jul 19, 2023

@sgf we can't realize the main of your issue with this data. Please give more info and the URL and configs.

This problem occurs on a customer's machine, and I will continue to keep an eye on it. If the same thing happens next time, I will report it here to add more details. If it doesn't happen again, please ignore my submission.

@bezzad bezzad closed this as completed Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Downloader
Awaiting triage
Development

No branches or pull requests

3 participants