HTTP_RANGE=bytes=0-3, 4-5,9-11
--FILE--
<?php
-$_SERVER['HTTP_RANGE'] = 'bytes=0-3, 4-5,9-11';
http_send_content_type('text/plain');
http_send_data(str_repeat('123abc', 1000));
?>
--- /dev/null
+--TEST--
+http_send_data() NIL-NIL range
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0
+--FILE--
+<?php
+http_send_content_type('text/plain');
+http_send_data("abc");
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Content-Type: text/plain
+Accept-Ranges: bytes
+Content-Range: bytes 0-0/3
+Content-Length: 1
+
+a
--- /dev/null
+--TEST--
+http_send_data() multiple ranges
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0,-1
+--FILE--
+<?php
+http_send_content_type('text/plain');
+http_send_data("01");
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Type: multipart/byteranges; boundary=%d.%d
+
+
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 0-0/2
+
+0
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 1-1/2
+
+1
+--%d.%d--
--- /dev/null
+--TEST--
+http_send_file() first/last byte range
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0,-1
+--FILE--
+<?php
+http_send_content_type("text/plain");
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Type: multipart/byteranges; boundary=%d.%d
+
+
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 0-0/1010
+
+0
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 1009-1009/1010
+
+
+
+--%d.%d--
--- /dev/null
+--TEST--
+http_send_file() NIL-NIL range
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Range: bytes 0-0/1010
+Content-Length: 1
+Content-type: %s
+
+0