diff options
-rw-r--r-- | lib/rainbows/response.rb | 2 | ||||
-rw-r--r-- | t/byte-range-common.sh | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/rainbows/response.rb b/lib/rainbows/response.rb index c0d0740..705de62 100644 --- a/lib/rainbows/response.rb +++ b/lib/rainbows/response.rb @@ -140,6 +140,8 @@ module Rainbows::Response end if 0 > count || offset >= size + headers[Content_Length] = "0" + headers[Content_Range] = "bytes */#{clen}" return 416, headers, nil else count = size if count > size diff --git a/t/byte-range-common.sh b/t/byte-range-common.sh index 514a024..14050cf 100644 --- a/t/byte-range-common.sh +++ b/t/byte-range-common.sh @@ -56,7 +56,9 @@ t_begin "normal full request matches" && { t_begin "crazy offset goes over" && { range_insane=-r$(($random_blob_size * 2))-$(($random_blob_size * 4)) curl -vsS 2>$err $range_insane $url - grep 'HTTP/1\.[01] 416 ' $err || die "expected 416 error" + grep '^< HTTP/1\.[01] 416 ' $err || die "expected 416 error" + grep '^< Content-Range: bytes \*/'$random_blob_size $err || \ + die "expected Content-Range: bytes */SIZE" } t_begin "full request matches with explicit ranges" && { |