- extend & fixup test suite
authorMichael Wallner <mike@php.net>
Wed, 2 Nov 2005 13:21:22 +0000 (13:21 +0000)
committerMichael Wallner <mike@php.net>
Wed, 2 Nov 2005 13:21:22 +0000 (13:21 +0000)
65 files changed:
tests/HttpMessage_001.phpt
tests/HttpMessage_002.phpt [new file with mode: 0644]
tests/HttpRequestPool_001.phpt
tests/HttpRequest_001.phpt
tests/HttpRequest_002.phpt
tests/HttpRequest_003.phpt
tests/HttpResponse_001.phpt
tests/HttpResponse_002.phpt
tests/HttpResponse_003.phpt
tests/HttpResponse_004.phpt
tests/allowed_methods_001.phpt
tests/allowed_methods_001_logging.phpt
tests/allowed_methods_002.phpt [new file with mode: 0644]
tests/allowed_methods_002_logging.phpt [new file with mode: 0644]
tests/cloning_001.phpt
tests/etag_mode_001.phpt
tests/etag_mode_002.phpt
tests/etag_mode_003.phpt
tests/etag_mode_004.phpt
tests/etag_mode_011.phpt
tests/etag_mode_012.phpt
tests/etag_mode_013.phpt
tests/etag_mode_014.phpt
tests/etag_mode_031.phpt [new file with mode: 0644]
tests/etag_mode_032.phpt [new file with mode: 0644]
tests/etag_mode_033.phpt [new file with mode: 0644]
tests/etag_mode_034.phpt [new file with mode: 0644]
tests/etag_mode_041.phpt [new file with mode: 0644]
tests/etag_mode_042.phpt [new file with mode: 0644]
tests/etag_mode_043.phpt [new file with mode: 0644]
tests/etag_mode_044.phpt [new file with mode: 0644]
tests/etag_mode_crc.phpt
tests/exceptions.phpt
tests/redirect_001.phpt
tests/redirect_001_logging.phpt
tests/redirect_002.phpt
tests/redirect_002_logging.phpt
tests/redirect_003.phpt
tests/redirect_003_logging.phpt
tests/redirect_011.phpt [new file with mode: 0644]
tests/redirect_011_logging.phpt [new file with mode: 0644]
tests/redirect_012.phpt [new file with mode: 0644]
tests/redirect_012_logging.phpt [new file with mode: 0644]
tests/redirect_013.phpt [new file with mode: 0644]
tests/redirect_013_logging.phpt [new file with mode: 0644]
tests/send_data_007.phpt
tests/send_data_007_logging.phpt
tests/send_data_008.phpt
tests/send_data_009.phpt
tests/send_data_010.phpt [new file with mode: 0644]
tests/send_data_011.phpt [new file with mode: 0644]
tests/send_file_001.phpt
tests/send_file_002.phpt
tests/send_file_003.phpt
tests/send_file_004.phpt
tests/send_file_006.phpt
tests/send_file_007.phpt
tests/send_file_008.phpt [new file with mode: 0644]
tests/send_file_009.phpt [new file with mode: 0644]
tests/send_file_010.phpt [new file with mode: 0644]
tests/send_file_011.phpt [new file with mode: 0644]
tests/send_file_012.phpt [new file with mode: 0644]
tests/send_file_013.phpt [new file with mode: 0644]
tests/skip.inc
tests/urls.txt [new file with mode: 0644]

index 00e0e4b663f230023358d0f656f0318f601e18d0..eda359c487333bb00bcdf219a3964789e272e7a3 100644 (file)
@@ -3,7 +3,7 @@ HttpMessage
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 ?>
 --FILE--
 <?php
diff --git a/tests/HttpMessage_002.phpt b/tests/HttpMessage_002.phpt
new file mode 100644 (file)
index 0000000..d1fd173
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+HttpMessage properties
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkmin(5);
+checkcls('HttpMessage');
+?>
+--FILE--
+<?php
+class Message extends HttpMessage
+{
+       public function test()
+       {
+               print_r($this->headers);
+               $this->headers['Foo'] = 'Bar';
+       }
+}
+
+error_reporting(E_ALL|E_STRICT);
+
+echo "-TEST\n";
+$m = new Message;
+$m->test();
+echo "Done\n";
+?>
+--EXPECTF--
+%sTEST
+Array
+(
+)
+%sFatal error%sCannot access HttpMessage properties by reference or array key/index in%s
index 9f20fe4ee849fa631f391205f7f1effc7133cc3c..9adf35e9de459749c78287140623456dac9246e2 100644 (file)
@@ -3,7 +3,7 @@ HttpRequestPool
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcls('HttpRequestPool');
 checkurl('www.php.net');
 checkurl('de.php.net');
index cd6ae675a7eeba138f0d362728acac294ea9e2a8..0ff1b5baa881e617d25eb5fc27937b69e646de47 100644 (file)
@@ -3,7 +3,7 @@ HttpRequest options
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcls('HttpRequest');
 ?>
 --FILE--
index 76e12a31dfef91458674b38110697fd97127641c..ff8ab00da7761161d119a51fd50639348ec32cad 100644 (file)
@@ -3,7 +3,7 @@ HttpRequest GET/POST
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcls('HttpRequest');
 checkurl('www.google.com');
 checkurl('dev.iworks.at');
index 32b134cffb6092d10cee040c4b10e6873a3eff2c..d352b189b1d1289bbc4f763fef2ff70c92cfd1e4 100644 (file)
@@ -3,7 +3,7 @@ HttpRequest SSL
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcls('HttpRequest');
 checkurl('arweb.info');
 ?>
index 78b03e4b8fbf1d775292140489c0176bd6e6f193..56b1913fa3d8a959956f51d6646f9540abe52514 100644 (file)
@@ -3,7 +3,7 @@ HttpResponse - send data with caching headers
 --SKIPIF--
 <?php 
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcgi();
 ?>
 --FILE--
@@ -16,10 +16,10 @@ HttpResponse::send();
 --EXPECTF--
 X-Powered-By: PHP/%s
 ETag: "3858f62230ac3c915f300c664312c63f"
-Cache-Control: public, must-revalidate, max_age=3600
+Cache-Control: public, must-revalidate, max-age=3600
 Last-Modified: %s, %d %s 20%d %d:%d:%d GMT
 Content-Type: %s
 Accept-Ranges: bytes
 Content-Length: 6
 
-foobar
\ No newline at end of file
+foobar
index 1c69a7f2a7ed3656af99d779eb70c6913c17209d..72c22bcd574096a1e294e4503219e8e90a4bd585 100644 (file)
@@ -3,7 +3,7 @@ HttpResponse - send gzipped file
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcgi();
 checkext('zlib');
 ?>
index 4b5941cd815463d9548091a1b94564623a922d39..960c0c5814b6dce177a49cf4bcc7c67d36fdd43a 100644 (file)
@@ -3,7 +3,7 @@ HttpResponse - send gzipped file with caching headers
 --SKIPIF--
 <?php 
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcgi();
 checkext('zlib');
 ?>
@@ -20,7 +20,7 @@ HttpResponse::send();
 --EXPECTF--
 X-Powered-By: PHP/%s
 ETag: "%s"
-Cache-Control: public, must-revalidate, max_age=3600
+Cache-Control: public, must-revalidate, max-age=3600
 Last-Modified: %s, %d %s 20%d %d:%d:%d GMT
 Content-Type: %s
 Accept-Ranges: bytes
index a0f569dfe5c2ec47e62af8d376eab2b80b231c05..f5e768dd0299da42262fb3deec680dda19325f59 100644 (file)
@@ -3,8 +3,8 @@ HttpResponse - send cached gzipped data
 --SKIPIF--
 <?php 
 include 'skip.inc';
-checkver(5);
 checkcgi();
+checkmin(5.1);
 checkext('zlib');
 ?>
 --ENV--
@@ -20,7 +20,7 @@ HttpResponse::send();
 ?>
 --EXPECTF--
 Status: 304
-Content-type: %s
 X-Powered-By: PHP/%s
-Cache-Control: public, must-revalidate, max_age=3600
+Cache-Control: public, must-revalidate, max-age=3600
 ETag: "80b285463881575891e86ba7bfecb4d0"
+Content-type: %s
index f0b7d9c1b30af4a1606d4f35416eb850b9a3a0de..b7e3ba5725c7a42bd7979e7caa7db0177b584c8f 100644 (file)
@@ -4,6 +4,7 @@ allowed methods
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
index 9ae398d3d105ab4f835fd7e7273b2e8197102ed9..8c2e34144a29b07c6cb0eb51537098aaa96403d6 100644 (file)
@@ -4,6 +4,7 @@ logging allowed methods
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_HOST=example.com
diff --git a/tests/allowed_methods_002.phpt b/tests/allowed_methods_002.phpt
new file mode 100644 (file)
index 0000000..2185d8b
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+allowed methods
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+include 'log.inc';
+log_prepare(_AMETH_LOG);
+ini_set('http.allowed_methods', 'POST');
+echo "Done\n";
+?>
+--EXPECTF--
+Status: 405
+X-Powered-By: PHP/%s
+Allow: POST
+Content-type: %s
+
diff --git a/tests/allowed_methods_002_logging.phpt b/tests/allowed_methods_002_logging.phpt
new file mode 100644 (file)
index 0000000..73b458b
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+logging allowed methods
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--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
index 73b7734254f618815256c8d9779aae4f804db826..7b40fdc5f0d03af938bb5dbadc63385e21ae7c54 100644 (file)
@@ -3,7 +3,7 @@ cloning
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 checkcls('HttpRequest');
 ?>
 --FILE--
index d8cf59458ebf99f03f52c8aba059696bef6caa6b..8c396fb4786ec5ddcabfb770d9b85d2ec1d86d01 100644 (file)
@@ -4,6 +4,7 @@ crc32 etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
index 229b22daec3f37ceb4a01313b383eb46828b9ff2..e0d809dd3895c0a7733750c0b4d4420399aee720 100644 (file)
@@ -4,6 +4,7 @@ sha1 etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
index 76abcfc3d4e21578c5a5ba933f1b8374019cfe66..1e7789c4d2cc9caa48b89de037abe56cafa61926 100644 (file)
@@ -4,6 +4,7 @@ md5 etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
index c1920ce0d874a7f1e08b97447078267a1f9f4dc6..b8bb04d9f068d7df17106af9e24d315bbc697c67 100644 (file)
@@ -4,6 +4,7 @@ mhash etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 skipif(!http_support(HTTP_SUPPORT_MHASHETAGS), 'need mhash support');
 skipif(!defined('HTTP_ETAG_MHASH_WHIRLPOOL'), 'need whirlpool mhash support');
 ?>
index 06b35e10666decb8167f8159312a455e13e8894b..d4a2712e5b9e81213b0e1560625e9710afe084e0 100644 (file)
@@ -4,6 +4,7 @@ ob crc32 etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
index 57c887259111cf662d616dc29df821637557e265..72901e430d2a966def9a15691646239b2efc6d45 100644 (file)
@@ -4,6 +4,7 @@ ob sha1 etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 skipif(!http_support(HTTP_SUPPORT_MHASHETAGS), 'need mhash support');
 ?>
 --FILE--
index 4100173dd724b16ff225a2e7d086a1f89492b124..d81ba60d1e7dee8e96eab454b5676a79c0ff924c 100644 (file)
@@ -4,6 +4,7 @@ ob md5 etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
index 6999bff2f3855a40bc5a939bc04bfd40fa1455a6..29be1dec19d30174049f21249823b4f3fe0aead0 100644 (file)
@@ -4,6 +4,7 @@ ob mhash etag
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 skipif(!http_support(HTTP_SUPPORT_MHASHETAGS), 'need mhash support');
 skipif(!defined('HTTP_ETAG_MHASH_WHIRLPOOL'), 'need whirlpool mhash support');
 ?>
diff --git a/tests/etag_mode_031.phpt b/tests/etag_mode_031.phpt
new file mode 100644 (file)
index 0000000..1ac27e2
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+crc32 etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_CRC32);
+http_cache_etag();
+http_send_data("abc\n");
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Cache-Control: private, must-revalidate, max-age=0
+Accept-Ranges: bytes
+ETag: "4e818847"
+Content-Length: 4
+Content-type: %s
+
+abc
diff --git a/tests/etag_mode_032.phpt b/tests/etag_mode_032.phpt
new file mode 100644 (file)
index 0000000..3806381
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+sha1 etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_SHA1);
+http_cache_etag();
+http_send_data("abc\n");
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Cache-Control: private, must-revalidate, max-age=0
+Accept-Ranges: bytes
+ETag: "03cfd743661f07975fa2f1220c5194cbaff48451"
+Content-Length: 4
+Content-type: %s
+
+abc
diff --git a/tests/etag_mode_033.phpt b/tests/etag_mode_033.phpt
new file mode 100644 (file)
index 0000000..f87f3fa
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+md5 etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_MD5);
+http_cache_etag();
+http_send_data("abc\n");
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Cache-Control: private, must-revalidate, max-age=0
+Accept-Ranges: bytes
+ETag: "0bee89b07a248e27c83fc3d5951213c1"
+Content-Length: 4
+Content-type: %s
+
+abc
diff --git a/tests/etag_mode_034.phpt b/tests/etag_mode_034.phpt
new file mode 100644 (file)
index 0000000..b8bb04d
--- /dev/null
@@ -0,0 +1,25 @@
+--TEST--
+mhash etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmax(5.0);
+skipif(!http_support(HTTP_SUPPORT_MHASHETAGS), 'need mhash support');
+skipif(!defined('HTTP_ETAG_MHASH_WHIRLPOOL'), 'need whirlpool mhash support');
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_MHASH_WHIRLPOOL);
+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: "53efa9e423f86dabd449b3e23dd0350def661b9e7055b23ceb2230c8b61bc0766514957ea9d349a88ef794715a1a17a409b549edfd6f43d696e63407fff3541c"
+Content-Length: 4
+
+abc
diff --git a/tests/etag_mode_041.phpt b/tests/etag_mode_041.phpt
new file mode 100644 (file)
index 0000000..3e15bc1
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+ob crc32 etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_CRC32);
+http_cache_etag();
+print("abc\n");
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Cache-Control: private, must-revalidate, max-age=0
+ETag: "4e818847"
+Content-type: %s
+
+abc
diff --git a/tests/etag_mode_042.phpt b/tests/etag_mode_042.phpt
new file mode 100644 (file)
index 0000000..68aab73
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+ob sha1 etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+skipif(!http_support(HTTP_SUPPORT_MHASHETAGS), 'need mhash support');
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_SHA1);
+http_cache_etag();
+print("abc\n");
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Cache-Control: private, must-revalidate, max-age=0
+ETag: "03cfd743661f07975fa2f1220c5194cbaff48451"
+Content-type: %s
+
+abc
diff --git a/tests/etag_mode_043.phpt b/tests/etag_mode_043.phpt
new file mode 100644 (file)
index 0000000..251381b
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+ob md5 etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_MD5);
+http_cache_etag();
+print("abc\n");
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Cache-Control: private, must-revalidate, max-age=0
+ETag: "0bee89b07a248e27c83fc3d5951213c1"
+Content-type: %s
+
+abc
diff --git a/tests/etag_mode_044.phpt b/tests/etag_mode_044.phpt
new file mode 100644 (file)
index 0000000..c7c3e10
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+ob mhash etag
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+skipif(!http_support(HTTP_SUPPORT_MHASHETAGS), 'need mhash support');
+skipif(!defined('HTTP_ETAG_MHASH_WHIRLPOOL'), 'need whirlpool mhash support');
+?>
+--FILE--
+<?php
+ini_set('http.etag_mode', HTTP_ETAG_MHASH_WHIRLPOOL);
+http_cache_etag();
+print("abc\n");
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Cache-Control: private, must-revalidate, max-age=0
+ETag: "53efa9e423f86dabd449b3e23dd0350def661b9e7055b23ceb2230c8b61bc0766514957ea9d349a88ef794715a1a17a409b549edfd6f43d696e63407fff3541c"
+Content-type: %s
+
+abc
index ffe5a0621e7b8d56496975f8ed2f5cc2bc247ee5..62fbb3feb5faa4fd309bb203f0232a0b15bfa138 100644 (file)
@@ -3,7 +3,7 @@ sane crc etags
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5.1);
+checkmin(5.1);
 skipif(!http_support(HTTP_SUPPORT_MHASHETAGS), 'need mhash support');
 skipif(!defined('HTTP_ETAG_MHASH_CRC32'), 'need CRC32 mhash support');
 skipif(!defined('HTTP_ETAG_MHASH_CRC32B'), 'need CRC32B mhash support');
index aef60595ab0108c19fccad565f094159133fd97c..9fddddd94f00950a65bbddb6bd14ac3d8e2fe8d1 100644 (file)
@@ -3,7 +3,7 @@ exceptions
 --SKIPIF--
 <?php
 include 'skip.inc';
-checkver(5);
+checkmin(5);
 ?>
 --FILE--
 <?php
index d4e7bbd7a778e8bb5ac83fbba9039c6e3bfacef9..f85d98f4d70caacb00aafd335af18829c28da193 100644 (file)
@@ -4,6 +4,7 @@ http_redirect() with params
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_HOST=localhost
@@ -15,7 +16,7 @@ http_redirect('redirect', array('a' => 1, 'b' => 2));
 ?>
 --EXPECTF--
 Status: 302
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Location: http://localhost/redirect?a=1&b=2
 
index b2d1361e8f00e77a14f7ecc1a1dc1790ca9ffae2..273f8b8435dd91e7fe0080113233b07ad6328297 100644 (file)
@@ -4,6 +4,7 @@ logging redirects
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_HOST=example.com
index e577810b05f5c5d080d778fd6404da74cb043922..29985f3507375eb3f666f36067f5d3f545e70fe3 100644 (file)
@@ -4,6 +4,7 @@ http_redirect() with session
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 checkext('session');
 ?>
 --ENV--
@@ -17,7 +18,7 @@ http_redirect('redirect', array('a' => 1), true);
 ?>
 --EXPECTF--
 Status: 302
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Set-Cookie: PHPSESSID=%s; path=/
 Expires: %s
index b2d1361e8f00e77a14f7ecc1a1dc1790ca9ffae2..273f8b8435dd91e7fe0080113233b07ad6328297 100644 (file)
@@ -4,6 +4,7 @@ logging redirects
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_HOST=example.com
index 0de0195fd8370145e3606fb45bad45a8b022c776..6396e09e79f8178042576a4b01b7776a2906cdcb 100644 (file)
@@ -4,6 +4,7 @@ http_redirect() permanent
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_HOST=localhost
@@ -15,7 +16,7 @@ http_redirect('redirect', null, false, HTTP_REDIRECT_PERM);
 ?>
 --EXPECTF--
 Status: 301
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Location: http://localhost/redirect
 
index 7da64052656e1518288d0fc97e6c93b305aa92d1..eb282d2cf51c26bdc3754af2f9ade178d215888e 100644 (file)
@@ -4,6 +4,7 @@ logging redirects
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_HOST=example.com
diff --git a/tests/redirect_011.phpt b/tests/redirect_011.phpt
new file mode 100644 (file)
index 0000000..fc3f3d2
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+http_redirect() with params
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--ENV--
+HTTP_HOST=localhost
+--FILE--
+<?php
+include 'log.inc';
+log_prepare(_REDIR_LOG);
+http_redirect('redirect', array('a' => 1, 'b' => 2));
+?>
+--EXPECTF--
+Status: 302
+X-Powered-By: PHP/%s
+Location: http://localhost/redirect?a=1&b=2
+Content-type: %s
+
+Redirecting to <a href="http://localhost/redirect?a=1&b=2">http://localhost/redirect?a=1&b=2</a>.
+
diff --git a/tests/redirect_011_logging.phpt b/tests/redirect_011_logging.phpt
new file mode 100644 (file)
index 0000000..237c043
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+logging redirects
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--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
diff --git a/tests/redirect_012.phpt b/tests/redirect_012.phpt
new file mode 100644 (file)
index 0000000..1d48ae5
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+http_redirect() with session
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+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
+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
+Content-type: %s
diff --git a/tests/redirect_012_logging.phpt b/tests/redirect_012_logging.phpt
new file mode 100644 (file)
index 0000000..237c043
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+logging redirects
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--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
diff --git a/tests/redirect_013.phpt b/tests/redirect_013.phpt
new file mode 100644 (file)
index 0000000..8ef8a6b
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+http_redirect() permanent
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--ENV--
+HTTP_HOST=localhost
+--FILE--
+<?php
+include 'log.inc';
+log_prepare(_REDIR_LOG);
+http_redirect('redirect', null, false, HTTP_REDIRECT_PERM);
+?>
+--EXPECTF--
+Status: 301
+X-Powered-By: PHP/%s
+Location: http://localhost/redirect
+Content-type: %s
+
+Redirecting to <a href="http://localhost/redirect">http://localhost/redirect</a>.
+
diff --git a/tests/redirect_013_logging.phpt b/tests/redirect_013_logging.phpt
new file mode 100644 (file)
index 0000000..0a98118
--- /dev/null
@@ -0,0 +1,21 @@
+--TEST--
+logging redirects
+--SKIPIF--
+<?php
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--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
index f6d6058388b4735eb380f8bd223813b4107a2452..478d58dc82c028c0059e9e3e60a6dfc666c3f548 100644 (file)
@@ -4,6 +4,7 @@ http_send_data() etag caching
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_IF_NONE_MATCH="0bee89b07a248e27c83fc3d5951213c1"
@@ -16,7 +17,7 @@ http_send_data("abc\n");
 ?>
 --EXPECTF--
 Status: 304
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Cache-Control: private, must-revalidate, max-age=0
 %s
index 1fbab30a2114a3c4bb2d55d39da5da7c431ded1f..ed7719be54b4ece36bb7352e88d369fb6d8f6195 100644 (file)
@@ -4,6 +4,7 @@ logging caching
 <?php
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_HOST=example.com
index cb0fc6df094c61cc7b5c7f2480456bb963406005..f5d4e85aac8838f2589f9da41e8a3001edc076b8 100644 (file)
@@ -4,6 +4,7 @@ http_send_data() HTTP_SENDBUF_SIZE long string
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
@@ -11,9 +12,9 @@ http_throttle(0.01, 1);
 http_send_data('00000000000000000000');
 ?>
 --EXPECTF--
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Accept-Ranges: bytes
 Content-Length: 20
 
-00000000000000000000
\ No newline at end of file
+00000000000000000000
index 8fb18685d56e5f9c576ad630d361849f0d4811d4..1d8358d7f2010f38bfb0f9bc1727148efed2801b 100644 (file)
@@ -4,6 +4,7 @@ http_send_data() last modified caching
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
@@ -11,7 +12,7 @@ http_cache_last_modified(-5);
 http_send_data("abc\n");
 ?>
 --EXPECTF--
-Content-type: text/html
+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
diff --git a/tests/send_data_010.phpt b/tests/send_data_010.phpt
new file mode 100644 (file)
index 0000000..9553c8d
--- /dev/null
@@ -0,0 +1,20 @@
+--TEST--
+http_send_data() HTTP_SENDBUF_SIZE long string
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+http_throttle(0.01, 1);
+http_send_data('00000000000000000000');
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Length: 20
+Content-type: %s
+
+00000000000000000000
diff --git a/tests/send_data_011.phpt b/tests/send_data_011.phpt
new file mode 100644 (file)
index 0000000..9506078
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+http_send_data() last modified caching
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+http_cache_last_modified(-5);
+http_send_data("abc\n");
+?>
+--EXPECTF--
+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
+Content-type: %s
+
+abc
index c4b2af54aa974225a869d13356b197b2ca751910..c10507535a0318fbf361c4dc3e006e42d46a2746 100644 (file)
@@ -4,13 +4,14 @@ http_send_file()
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --FILE--
 <?php
 http_send_file('data.txt');
 ?>
 --EXPECTF--
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Accept-Ranges: bytes
 Content-Length: 1010
index da87c5ff616e3da3f8482a95b0d07d2096cbdec4..1bcd07d70b6e2ee3ce6871e3971f9d2737ebedb4 100644 (file)
@@ -4,6 +4,7 @@ http_send_file() NUM-NUM range
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_RANGE=bytes=5-9
@@ -13,10 +14,10 @@ http_send_file('data.txt');
 ?>
 --EXPECTF--
 Status: 206
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Accept-Ranges: bytes
 Content-Range: bytes 5-9/1010
 Content-Length: 5
 
-56789
\ No newline at end of file
+56789
index 9e3986b34b1c88c92f5c803f817b73c29fe9b5a5..8a17f58492265326fa07ee809d193e8db599c066 100644 (file)
@@ -4,6 +4,7 @@ http_send_file() NIL-NUM range
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_RANGE=bytes=-9
@@ -13,7 +14,7 @@ http_send_file('data.txt');
 ?>
 --EXPECTF--
 Status: 206
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Accept-Ranges: bytes
 Content-Range: bytes 1001-1009/1010
index 54c0212043cfe057752edf9b627ea71722414080..5dcee32221c41927143cc0d478e5c0a0810b746e 100644 (file)
@@ -4,6 +4,7 @@ http_send_file() NUM-NIL range
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_RANGE=bytes=1000-
@@ -13,7 +14,7 @@ http_send_file('data.txt');
 ?>
 --EXPECTF--
 Status: 206
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Accept-Ranges: bytes
 Content-Range: bytes 1000-1009/1010
index 10f170a2f44583b19a4931f831424a8925847875..fdca630c34a20e4ca52a94eb1edf80d3ce0ba5b0 100644 (file)
@@ -4,6 +4,7 @@ http_send_file() syntactically invalid range
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_RANGE=bytes=xxx
@@ -12,7 +13,7 @@ HTTP_RANGE=bytes=xxx
 http_send_file('data.txt');
 ?>
 --EXPECTF--
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
 Accept-Ranges: bytes
 Content-Length: 1010
index a33754630cab0ef9792c1f466a3f92828f34e22b..966129c8fe56b2323c71f8e9ae450098ecd74fbc 100644 (file)
@@ -4,6 +4,7 @@ http_send_file() oversized range
 <?php 
 include 'skip.inc';
 checkcgi();
+checkmax(5.0);
 ?>
 --ENV--
 HTTP_RANGE=bytes=-1111
@@ -13,5 +14,5 @@ http_send_file('data.txt');
 ?>
 --EXPECTF--
 Status: 416
-Content-type: text/html
+Content-type: %s
 X-Powered-By: PHP/%s
diff --git a/tests/send_file_008.phpt b/tests/send_file_008.phpt
new file mode 100644 (file)
index 0000000..556cea7
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+http_send_file()
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Length: 1010
+Content-type: %s
+
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
diff --git a/tests/send_file_009.phpt b/tests/send_file_009.phpt
new file mode 100644 (file)
index 0000000..bc157a9
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+http_send_file() NUM-NUM range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--ENV--
+HTTP_RANGE=bytes=5-9
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Range: bytes 5-9/1010
+Content-Length: 5
+Content-type: %s
+
+56789
diff --git a/tests/send_file_010.phpt b/tests/send_file_010.phpt
new file mode 100644 (file)
index 0000000..20b853a
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+http_send_file() NIL-NUM range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--ENV--
+HTTP_RANGE=bytes=-9
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Range: bytes 1001-1009/1010
+Content-Length: 9
+Content-type: %s
+
+23456789
diff --git a/tests/send_file_011.phpt b/tests/send_file_011.phpt
new file mode 100644 (file)
index 0000000..5ac521f
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+http_send_file() NUM-NIL range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--ENV--
+HTTP_RANGE=bytes=1000-
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Range: bytes 1000-1009/1010
+Content-Length: 10
+Content-type: %s
+
+123456789
diff --git a/tests/send_file_012.phpt b/tests/send_file_012.phpt
new file mode 100644 (file)
index 0000000..0e4ce0e
--- /dev/null
@@ -0,0 +1,30 @@
+--TEST--
+http_send_file() syntactically invalid range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--ENV--
+HTTP_RANGE=bytes=xxx
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Length: 1010
+Content-type: %s
+
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
diff --git a/tests/send_file_013.phpt b/tests/send_file_013.phpt
new file mode 100644 (file)
index 0000000..e97a091
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+http_send_file() oversized range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+checkmin(5.1);
+?>
+--ENV--
+HTTP_RANGE=bytes=-1111
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 416
+X-Powered-By: PHP/%s
+Content-type: %s
index f273c91068d2cb8d0c8942c95fa032c90fe12c10..268edf16d1e96d49ff18836d080c92f0db0e0f99 100644 (file)
@@ -3,7 +3,8 @@ defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));
 function skipif($if, $skip) { if ($if) { fprintf(STDOUT, "skip $skip"); exit(); }}
 function checkcgi() { skipif(!strncasecmp('CLI', PHP_SAPI, 3), 'need CGI SAPI'); }
 function checkext($ext) { skipif(!extension_loaded($ext), "need ext/$ext"); }
-function checkver($ver) { skipif(round($ver,1) > round((double) PHP_VERSION,1), "need PHP v$ver"); }
+function checkmin($ver) { skipif(round($ver,1) > round((double) PHP_VERSION,1), sprintf("need PHP >= v%0.1f",$ver)); }
+function checkmax($ver) { skipif(round($ver,1) < round((double) PHP_VERSION,1), sprintf("need PHP <= v%0.1f",$ver)); }
 function checkurl($url) { skipif(!@fsockopen($url, 80), "$url not responsive"); }
 function checkcls($cls) { skipif(!class_exists($cls), "need class $cls"); }
 checkext('http');
diff --git a/tests/urls.txt b/tests/urls.txt
new file mode 100644 (file)
index 0000000..183c62e
--- /dev/null
@@ -0,0 +1,49 @@
+http://www.microsoft.com
+http://www.opensource.org
+http://www.google.com
+http://www.yahoo.com
+http://www.ibm.com
+http://www.mysql.com
+http://www.oracle.com
+http://www.ripe.net
+http://www.iana.org
+http://www.amazon.com
+http://www.netcraft.com
+http://www.heise.de
+http://www.chip.de
+http://www.ca.com
+http://www.cnet.com
+http://www.news.com
+http://www.cnn.com
+http://www.wikipedia.org
+http://www.dell.com
+http://www.hp.com
+http://www.cert.org
+http://www.mit.edu
+http://www.nist.gov
+http://www.ebay.com
+http://www.playstation.com
+http://www.uefa.com
+http://www.ieee.org
+http://www.apple.com
+http://www.sony.com
+http://www.symantec.com
+http://www.zdnet.com
+http://www.fujitsu.com
+http://www.supermicro.com
+http://www.hotmail.com
+http://www.ecma.com
+http://www.bbc.co.uk
+http://news.google.com
+http://www.foxnews.com
+http://www.msn.com
+http://www.wired.com
+http://www.sky.com
+http://www.usatoday.com
+http://www.cbs.com
+http://www.nbc.com
+http://slashdot.org
+http://www.bloglines.com
+http://www.techweb.com
+http://www.newslink.org
+http://www.un.org
\ No newline at end of file