- Newest
- Most votes
- Most comments
- My question is, is there any possibility that the response returns less bytes than expected? (Suppose the range is valid)
Only if the range you ask for exceeds the actual object size. for example you ask for Range: bytes=0-9
but the response is only 8 bytes.
- If the case above is possible, what kind of response will I get? Is there any sample response for this case?
If the range you ask for exceeds the actual response size you will get a 206 Partial Content
status code with the Content-Range
header containing the actual returned size. following the example in answer 1: you will get Content-Range: bytes 0-7/8
(the value after the /
provide the total size of the object being retrieved which should signal the client that there are no more parts)
If the starting byte of the requested range is beyond the total size of the object, S3 will return a 416 Requested Range Not Satisfiable
response. e.g., if you send Range: bytes=10-19
but the response is only 8 bytes.
- If the case above is possible, can I get the cause of this in the response?
The cause is not directly indicated but you can infer it from the 206 Partial Content
status code and the actual Content-Range
value.
- Can a temporary network issue lead to the case above?
No, the content range being returned is based on the range being requested and is determined when the download starts. so if a network issue happens during the download it will not affect it.
Relevant content
- asked 2 years ago
- asked 6 months ago
- Accepted Answerasked 6 years ago
- asked 2 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated a year ago
- Can I use ACM to issue private certificates when the AWS Private CA validity is less than 13 months?AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 4 months ago
"No, the content range being returned is based on the range being requested and is determined when the download starts. so if a network issue happens during the download it will not affect it." --> Does this mean that in case of network issue happening during the download, the 'content-range' is the same as the request, but the actual data received is less than the 'content-range' ?
Yes. just like would happen with any HTTP server (not just S3) and could also happen without specifying range. It's the recipient (client) responsibility to verify that the Content-Length header value matches the actual amount of bytes it received and to determine what to do in such case (e.g., to retry or to fail and show an error message).
Thanks! Just one last question. Is there any doc about your last comment ("It's the recipient (client) responsibility to verify that the Content-Length header value matches the actual amount of bytes it received and to determine what to do in such case") ?
This is generic for HTTP and not something specific to an AWS service.
Quote from RFC7320 Section 3.3.3 Message Body Length:
Usually a browser would show show an error on screen. for example Google Chrome would show
ERR_CONNECTION_CLOSED
like in the image here