Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

HTTP Server returning 1 byte lesser for Range HTTP GET request

I am implementing HTTP file downloader. I am trying to download files in chunks , each chunk is being downloaded via separate thread.

I am seeing problem with the last chunk only. For the last chunk, the server is returning 1 byte less than requested.

HTTP GET REQUEST SENT:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

GET /idman642build20.exe HTTP/1.1
Host: mirror2.internetdownloadmanager.com
Range: bytes=8388608-12243840
Connection: close

HTTP GET RESPONSE:

HTTP/1.1 206 Partial Content
Date: Sat, 31 Aug 2024 18:08:40 GMT
Server: Apache/2.4.37 (AlmaLinux) OpenSSL/1.1.1k
Last-Modified: Tue, 20 Aug 2024 21:29:03 GMT
ETag: "bad380-620241d5e53f9"
Accept-Ranges: bytes
Content-Length: 3855232
Content-Range: bytes 8388608-12243839/12243840
Connection: close
Content-Type: application/octet-stream

You can see above, I requested range 8388608-12243840 , but server is returning me 8388608-12243839 , i.e. 1 last byte is missing. chatGPT says it could be a bug on server. I am seeing this problem only with the last chunk of the file.

>Solution :

There are no bytes missing.

Content-Range: bytes 8388608-12243839/12243840

12243839 ist the maximum last-byte-pos (see the standard) for a content of size 12243840, because counting starts with index 0.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading