diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-05 10:54:45 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-05 10:54:45 -0800 |
commit | 16b24c86cecec0697b35ac321cddd500bc9cfdea (patch) | |
tree | 8c04405e5f6de58479cc57b18e51452092d219c1 /t/byte-range-common.sh | |
parent | 89e1f00cd540bca54c2cbcb7d9b6cad5e0e3cf34 (diff) | |
download | rainbows-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/byte-range-common.sh')
-rw-r--r-- | t/byte-range-common.sh | 21 |
1 files changed, 21 insertions, 0 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 |