How to download first 125 bytes and 125 last byte file via HTTP protocol ?
I believe you want to send an appropriate Range
header. See the HTTP/1.1 spec for more information. Be aware that not all servers will support this, mind you. You may need to transfer the whole file, just to get to the last 125 bytes. Of course, you can get just the first 125 bytes by requesing the whole thing, and then only reading the first 125 bytes before killing the connection.
In theory I believe you should be able to use:
Range: 0-124,-125
Note that this will give interesting results if the full response would be less than 250 bytes...
Accept-Ranges: bytes
Range: bytes=-255
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With