How to download a specific byte of a file via http

How to download the first 125 bytes and last 125 bytes via the HTTP protocol?

+3
source share
2 answers

I believe you want to send the appropriate header Range. See the HTTP / 1.1 spec for more information . Keep in mind that not all servers will support this, mind you. You may need to transfer the entire file to get the last 125 bytes. Of course, you can only get the first 125 bytes by doing all this and then only reading the first 125 bytes before you kill the connection.

In theory, I believe that you should be able to use:

Range: 0-124,-125

, , 250 ...

Accept-Ranges: bytes
Range: bytes=-255
+8

. -

+2

All Articles