+++ /dev/null
---TEST--
-allowed methods
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-include 'log.inc';
-log_prepare(_AMETH_LOG);
-ini_set('http.request.methods.allowed', 'POST');
-echo "Done\n";
-?>
---EXPECTF--
-Status: 405
-Content-type: %s
-X-Powered-By: PHP/%s
-Allow: POST
-
+++ /dev/null
---TEST--
-logging allowed methods
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_HOST=example.com
---FILE--
-<?php
-echo "-TEST\n";
-include 'log.inc';
-log_content(_AMETH_LOG);
-echo "Done";
-?>
---EXPECTF--
-%sTEST
-%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [405-ALLOWED] Allow: POST <%s>
-Done
+++ /dev/null
---TEST--
-crc32 etag (may fail because PHPs crc32 is actually crc32b)
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'crc32');
-http_cache_etag();
-http_send_data("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-Accept-Ranges: bytes
-ETag: "4e818847"
-Content-Length: 4
-
-abc
+++ /dev/null
---TEST--
-sha1 etag
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'sha1');
-http_cache_etag();
-http_send_data("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-Accept-Ranges: bytes
-ETag: "03cfd743661f07975fa2f1220c5194cbaff48451"
-Content-Length: 4
-
-abc
+++ /dev/null
---TEST--
-md5 etag
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'md5');
-http_cache_etag();
-http_send_data("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-Accept-Ranges: bytes
-ETag: "0bee89b07a248e27c83fc3d5951213c1"
-Content-Length: 4
-
-abc
+++ /dev/null
---TEST--
-ext/hash etag
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-skipif(!extension_loaded('hash'), 'need ext/hash support');
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'sha256');
-http_cache_etag();
-http_send_data("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-Accept-Ranges: bytes
-ETag: "edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb"
-Content-Length: 4
-
-abc
+++ /dev/null
---TEST--
-ob crc32 etag (may fail because PHPs crc32 is actually crc32b)
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'crc32');
-http_cache_etag();
-print("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-ETag: "4e818847"
-
-abc
+++ /dev/null
---TEST--
-ob sha1 etag
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'sha1');
-http_cache_etag();
-print("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-ETag: "03cfd743661f07975fa2f1220c5194cbaff48451"
-
-abc
+++ /dev/null
---TEST--
-ob md5 etag
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'md5');
-http_cache_etag();
-print("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-ETag: "0bee89b07a248e27c83fc3d5951213c1"
-
-abc
+++ /dev/null
---TEST--
-ob ext/hash etag
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-skipif(!extension_loaded('hash'), 'need ext/hash support');
-?>
---FILE--
-<?php
-ini_set('http.etag.mode', 'sha256');
-http_cache_etag();
-print("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-ETag: "edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb"
-
-abc
+++ /dev/null
---TEST--
-http_redirect() with params
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_HOST=localhost
---FILE--
-<?php
-include 'log.inc';
-log_prepare(_REDIR_LOG);
-http_redirect('redirect', array('a' => 1, 'b' => 2));
-?>
---EXPECTF--
-Status: 302
-Content-type: %s
-X-Powered-By: PHP/%s
-Location: http://localhost/redirect?a=1&b=2
-
-Redirecting to <a href="http://localhost/redirect?a=1&b=2">http://localhost/redirect?a=1&b=2</a>.
-
+++ /dev/null
---TEST--
-logging redirects
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_HOST=example.com
---FILE--
-<?php
-echo "-TEST\n";
-include 'log.inc';
-log_content(_REDIR_LOG);
-echo "Done";
-?>
---EXPECTF--
-%sTEST
-%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s>
-Done
+++ /dev/null
---TEST--
-http_redirect() with session
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-checkext('session');
-?>
---ENV--
-HTTP_HOST=localhost
---FILE--
-<?php
-include 'log.inc';
-log_prepare(_REDIR_LOG);
-session_start();
-http_redirect('redirect', array('a' => 1), true);
-?>
---EXPECTF--
-Status: 302
-Content-type: %s
-X-Powered-By: PHP/%s
-Set-Cookie: PHPSESSID=%s; path=/
-Expires: %s
-Cache-Control: %s
-Pragma: %s
-Location: http://localhost/redirect?a=1&PHPSESSID=%s
+++ /dev/null
---TEST--
-logging redirects
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_HOST=example.com
---FILE--
-<?php
-echo "-TEST\n";
-include 'log.inc';
-log_content(_REDIR_LOG);
-echo "Done";
-?>
---EXPECTF--
-%sTEST
-%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s>
-Done
+++ /dev/null
---TEST--
-http_redirect() permanent
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_HOST=localhost
---FILE--
-<?php
-include 'log.inc';
-log_prepare(_REDIR_LOG);
-http_redirect('redirect', null, false, HTTP_REDIRECT_PERM);
-?>
---EXPECTF--
-Status: 301
-Content-type: %s
-X-Powered-By: PHP/%s
-Location: http://localhost/redirect
-
-Redirecting to <a href="http://localhost/redirect">http://localhost/redirect</a>.
-
+++ /dev/null
---TEST--
-logging redirects
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_HOST=example.com
---FILE--
-<?php
-echo "-TEST\n";
-include 'log.inc';
-log_content(_REDIR_LOG);
-echo "Done";
-?>
---EXPECTF--
-%sTEST
-%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [301-REDIRECT] Location: http%s <%s>
-Done
+++ /dev/null
---TEST--
-http_send_data() etag caching
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_IF_NONE_MATCH="0bee89b07a248e27c83fc3d5951213c1"
---FILE--
-<?php
-include 'log.inc';
-log_prepare(_CACHE_LOG);
-http_cache_etag();
-http_send_data("abc\n");
-?>
---EXPECTF--
-Status: 304
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-%s
+++ /dev/null
---TEST--
-logging caching
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_HOST=example.com
---FILE--
-<?php
-echo "-TEST\n";
-include 'log.inc';
-log_content(_CACHE_LOG);
-echo "Done";
-?>
---EXPECTF--
-%sTEST
-%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [304-CACHE] ETag: "%s" <%s>
-Done
+++ /dev/null
---TEST--
-http_send_data() HTTP_SENDBUF_SIZE long string
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-http_throttle(0.01, 1);
-http_send_data('00000000000000000000');
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Accept-Ranges: bytes
-Content-Length: 20
-
-00000000000000000000
+++ /dev/null
---TEST--
-http_send_data() last modified caching
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-http_cache_last_modified(-5);
-http_send_data("abc\n");
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Cache-Control: private, must-revalidate, max-age=0
-Last-Modified: %s, %d %s %d %d:%d:%d GMT
-Accept-Ranges: bytes
-Content-Length: 4
-
-abc
+++ /dev/null
---TEST--
-http_send() failed precondition
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5);
-?>
---FILE--
-<?php
-$_SERVER['HTTP_RANGE'] = 'bytes=0-1';
-$_SERVER['HTTP_IF_UNMODIFIED_SINCE'] = http_date(10000);
-http_cache_last_modified();
-http_send_file(__FILE__);
-?>
---EXPECTF--
-Status: 412
-X-Powered-By: %s
-Cache-Control: private, must-revalidate, max-age=0
-Last-Modified: %s
-Accept-Ranges: bytes
+++ /dev/null
---TEST--
-http_send_file()
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---FILE--
-<?php
-http_send_file('data.txt');
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Accept-Ranges: bytes
-Content-Length: 1010
-
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+++ /dev/null
---TEST--
-http_send_file() NUM-NUM range
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_RANGE=bytes=5-9
---FILE--
-<?php
-http_send_file('data.txt');
-?>
---EXPECTF--
-Status: 206
-Content-type: %s
-X-Powered-By: PHP/%s
-Accept-Ranges: bytes
-Content-Range: bytes 5-9/1010
-Content-Length: 5
-
-56789
+++ /dev/null
---TEST--
-http_send_file() NIL-NUM range
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_RANGE=bytes=-9
---FILE--
-<?php
-http_send_file('data.txt');
-?>
---EXPECTF--
-Status: 206
-Content-type: %s
-X-Powered-By: PHP/%s
-Accept-Ranges: bytes
-Content-Range: bytes 1001-1009/1010
-Content-Length: 9
-
-23456789
+++ /dev/null
---TEST--
-http_send_file() NUM-NIL range
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_RANGE=bytes=1000-
---FILE--
-<?php
-http_send_file('data.txt');
-?>
---EXPECTF--
-Status: 206
-Content-type: %s
-X-Powered-By: PHP/%s
-Accept-Ranges: bytes
-Content-Range: bytes 1000-1009/1010
-Content-Length: 10
-
-123456789
+++ /dev/null
---TEST--
-http_send_file() syntactically invalid range
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_RANGE=bytes=xxx
---FILE--
-<?php
-http_send_file('data.txt');
-?>
---EXPECTF--
-Content-type: %s
-X-Powered-By: PHP/%s
-Accept-Ranges: bytes
-Content-Length: 1010
-
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+++ /dev/null
---TEST--
-http_send_file() oversized range
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5.0);
-?>
---ENV--
-HTTP_RANGE=bytes=-1111
---FILE--
-<?php
-http_send_file('data.txt');
-?>
---EXPECTF--
-Status: 416
-Content-type: %s
-X-Powered-By: PHP/%s
+++ /dev/null
---TEST--
-http_send() If-Range
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5);
-?>
---FILE--
-<?php
-$_SERVER['HTTP_RANGE'] = 'bytes=0-1';
-$_SERVER['HTTP_IF_RANGE'] = '"abc"';
-http_cache_etag('abc');
-http_send_file(__FILE__);
-?>
---EXPECTF--
-Status: 206
-X-Powered-By: %s
-Cache-Control: private, must-revalidate, max-age=0
-ETag: "abc"
-Accept-Ranges: bytes
-Content-Range: bytes 0-1/%d
-Content-Length: 2
-
-<?
+++ /dev/null
---TEST--
-http_send() If-Range
---SKIPIF--
-<?php
-include 'skip.inc';
-checkcgi();
-checkmax(5);
-?>
---FILE--
-<?php
-$_SERVER['HTTP_RANGE'] = 'bytes=0-1';
-$_SERVER['HTTP_IF_RANGE'] = '"abcd"';
-http_cache_etag('abc');
-http_send_file(__FILE__);
-?>
---EXPECTF--
-X-Powered-By: %s
-Cache-Control: private, must-revalidate, max-age=0
-ETag: "abc"
-Accept-Ranges: bytes
-Content-Length: %d
-
-%s