Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When a "range: bytes=start-end" header is supplied where end < start, localstack's S3 implementation returns a 416 response.
localstack/localstack/services/s3/utils.py
Lines 208 to 222 in 279aea1
By contrast AWS returns the entire content.
Expected Behavior
AWS Behaviour returns the entire content if end < start:
$ echo "Hello World" > test.txt
$ aws s3 cp test.txt s3://ratt-public-data # Permissions needed to upload, but I've left test.txt here
$ curl -H "range: bytes=1-0" https://ratt-public-data.s3.af-south-1.amazonaws.com/test.txt
Hello World
$ curl -H "range: bytes=15-1" https://ratt-public-data.s3.af-south-1.amazonaws.com/test.txt
Hello World
How are you starting LocalStack?
With the localstack
script
Steps To Reproduce
Localstack behaviour for a "range: bytes=1-0" header returns a 416 response:
$ echo "Hello World" > test.txt
$ localstack start -d
$ awslocal s3api create-bucket --bucket sample-bucket --region=us-east-1
{
"Location": "/sample-bucket"
}
$ awslocal s3api put-object --bucket sample-bucket --key test.txt --body test.txt --region=us-east-1
{
"ETag": "\"e59ff97941044f85df5297e1c302d260\""
}
$ curl -H "range: bytes=1-0" http://localhost:4566/sample-bucket/test.txt
<?xml version='1.0' encoding='utf-8'?>
<Error><Code>InvalidRange</Code><Message>The requested range is not satisfiable</Message><RequestId>aa8a2346-5dc0-4728-971c-a74839b3f1b0</RequestId><ActualObjectSize>12</ActualObjectSize><RangeRequested>bytes=1-0</RangeRequested></Error>
Environment
- OS: Ubuntu 20.04
- LocalStack: 2.2.0
Anything else?
No response