about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-05 10:54:45 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-05 10:54:45 -0800
commit16b24c86cecec0697b35ac321cddd500bc9cfdea (patch)
tree8c04405e5f6de58479cc57b18e51452092d219c1 /t
parent89e1f00cd540bca54c2cbcb7d9b6cad5e0e3cf34 (diff)
downloadrainbows-16b24c86cecec0697b35ac321cddd500bc9cfdea.tar.gz
This is useful for clients that specify a bad range,
we can preserve the connection for them to specify
a good response.
Diffstat (limited to 't')
-rw-r--r--t/byte-range-common.sh21
-rwxr-xr-xt/t0022-copy_stream-byte-range.sh2
-rwxr-xr-xt/t0023-sendfile-byte-range.sh2
3 files changed, 23 insertions, 2 deletions
diff --git a/t/byte-range-common.sh b/t/byte-range-common.sh
index 14050cf..b4852a6 100644
--- a/t/byte-range-common.sh
+++ b/t/byte-range-common.sh
@@ -61,6 +61,27 @@ t_begin "crazy offset goes over" && {
           die "expected Content-Range: bytes */SIZE"
 }
 
+t_begin "keepalive/pipelining is supported on 416 responses" && {
+        rm -f $tmp
+        (
+                cat $fifo > $tmp &
+                printf 'GET /byte-range-common.sh HTTP/1.1\r\n'
+                printf 'Host: %s\r\n' $listen
+                printf 'Range: bytes=9999999999-9999999999\r\n\r\n'
+                printf 'GET /byte-range-common.sh HTTP/1.1\r\n'
+                printf 'Host: %s\r\n' $listen
+                printf 'Connection: close\r\n'
+                printf 'Range: bytes=0-0\r\n\r\n'
+                wait
+        ) | socat - TCP:$listen > $fifo
+
+        < $tmp awk '
+/^HTTP\/1\.1 / && NR == 1 && $2 == 416 { first = $2 }
+/^HTTP\/1\.1 / && NR != 1 && $2 == 206 { second = $2 }
+END { exit((first == 416 && second == 206) ? 0 : 1) }
+        '
+}
+
 t_begin "full request matches with explicit ranges" && {
         sha1="$(curl -v 2>$err $range_all -sSf $url | rsha1)"
         check_content_range
diff --git a/t/t0022-copy_stream-byte-range.sh b/t/t0022-copy_stream-byte-range.sh
index e4fcdbf..7539c02 100755
--- a/t/t0022-copy_stream-byte-range.sh
+++ b/t/t0022-copy_stream-byte-range.sh
@@ -17,7 +17,7 @@ ThreadSpawn|WriterThreadSpawn|ThreadPool|WriterThreadPool|Base) ;;
         ;;
 esac
 
-t_plan 12 "IO.copy_stream byte range response for $model"
+t_plan 13 "IO.copy_stream byte range response for $model"
 
 t_begin "setup and startup" && {
         rtmpfiles out err
diff --git a/t/t0023-sendfile-byte-range.sh b/t/t0023-sendfile-byte-range.sh
index 89fbd7a..81183c7 100755
--- a/t/t0023-sendfile-byte-range.sh
+++ b/t/t0023-sendfile-byte-range.sh
@@ -17,7 +17,7 @@ EventMachine|NeverBlock)
 *) ;;
 esac
 
-t_plan 12 "sendfile byte range response for $model"
+t_plan 13 "sendfile byte range response for $model"
 
 t_begin "setup and startup" && {
         rtmpfiles out err