about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-30 08:32:22 +0000
committerEric Wong <normalperson@yhbt.net>2011-01-04 16:21:17 -0800
commita471d10cd793c4dc7182b4e588a21d6ac7c41de7 (patch)
tree2edaafc3f753f22fe08e995d3fa54398c5e129a5
parentdc77752eb7bfe528c60dc0ac028717877342e22a (diff)
downloadrainbows-a471d10cd793c4dc7182b4e588a21d6ac7c41de7.tar.gz
Although curl did not complain, 206 is the correct error
code for partial HTTP responses.
-rw-r--r--lib/rainbows/response/range.rb2
-rw-r--r--t/byte-range-common.sh1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/rainbows/response/range.rb b/lib/rainbows/response/range.rb
index 5d8f01e..b383587 100644
--- a/lib/rainbows/response/range.rb
+++ b/lib/rainbows/response/range.rb
@@ -27,7 +27,7 @@ module Rainbows::Response::Range
       count = clen if count > clen
       headers[Content_Length] = count.to_s
       headers[Content_Range] = "bytes #{offset}-#{offset+count-1}/#{clen}"
-      [ status, offset, count ]
+      [ 206, offset, count ]
     end
     # nil if no status
   end
diff --git a/t/byte-range-common.sh b/t/byte-range-common.sh
index 120aad6..514a024 100644
--- a/t/byte-range-common.sh
+++ b/t/byte-range-common.sh
@@ -14,6 +14,7 @@ t_begin "byte-range setup vars" && {
 }
 
 check_content_range () {
+        grep '^< HTTP/1\.1 206 Partial Content' $err
         grep 'Range:' $err
         # Content-Range: bytes #{offset}-#{offset+count-1}/#{clen}
         d='\([0-9]\+\)'