microsoft / BITS-Manager

The BITS Manager is a sample WPF C#/.NET utility to examine and control your BITS uploads and downloads
MIT License
77 stars 23 forks source link

"Range" header missing in BITS download request randomly #14

Open shv07 opened 2 years ago

shv07 commented 2 years ago

I have implemented a web api server to handle BITS download requests according to this. At the server end, the first Get request header does not contain the key Range sometimes.

BITS keeps retrying and finally the job reaches Error-State. For smaller files ~2MB this works properly if entire file is sent in this case, but for file bigger files (~350 MB) BITS keeps retrying. Is it the expected behavior or BITS expects some other Response here?

pedasmith commented 2 years ago

Short answer: BITS is like that. There's a ton of options for the client to download files; some of them will result in the client not including the range header. One reason is that we try to have BITS work against a variety of servers; some of them don't support the RANGE header. Note also that some uses of BITS are via the UWP BackgroundDownloader and BackgroundUploader. Peter On Thursday, June 30, 2022 at 10:08:42 AM EDT, Shivji Bhagat @.***> wrote:

I have implemented a web api server to handle BITS download requests according to this. At the server end, the first Get request header does not contain the key Range sometimes.

BITS keeps retrying unless the entire file is sent in the response even if the file is as big as 350 MB. Is it the expected behavior or BITS expects some other Response here?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

shv07 commented 2 years ago

Thanks for your reply @pedasmith

The server that I have implemented does support Range header, and is also working properly when the BITS sends the Range header.

But sometimes, for same files it does not send Range-request. If I send the entire file in such cases instead of partial content, it works for small files (tried with <2 MB, the files get properly downloaded). But the same approach of sending the entire file does not work if a non-Range request is recieved for larger files (tried with ~350 MB files, BITS keeps sending requests without Range header and finally throws error that the server does not follow expected protocol).

So what is the expected Response from the server if BITS does not send a Range header?

pedasmith commented 1 year ago

Thanks for the reply. I'll dig into this, but it may take a week or more (I'm on vacation and don't have my normal access to work information) Peter On Monday, July 4, 2022 at 02:22:56 AM EDT, Shivji Bhagat @.***> wrote:

Thanks for your reply @pedasmith

The server that I have implemented does support Range header, and is also working properly when the BITS sends the Range header.

But sometimes, for same files it does not send Range-request. If I send the entire file in such cases instead of partial content, it works for small files (tried with <2 MB, the files get properly downloaded). But the same approach of sending the entire file does not work if a non-Range request is recieved for larger files (tried with ~350 MB files, BITS keeps sending requests without Range header and finally throws error that the server does not follow expected protocol).

So what is the expected Response from the server if BITS does not send a Range header?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>