summaryrefslogtreecommitdiff
path: root/sapi/cli/tests
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2013-12-12 20:43:34 +0100
committerOndřej Surý <ondrej@sury.org>2013-12-12 20:43:34 +0100
commit5a58c4dae727fbc8bd92770c2708baf9e7688857 (patch)
tree90fbbe41815b12676f14d692bfcf00e03cfad008 /sapi/cli/tests
parent0d7d3241164b4769b93867da2e8adb724ae17950 (diff)
downloadphp-5a58c4dae727fbc8bd92770c2708baf9e7688857.tar.gz
New upstream version 5.5.7+dfsgupstream/5.5.7+dfsg
Diffstat (limited to 'sapi/cli/tests')
-rw-r--r--sapi/cli/tests/php_cli_server_019.phpt68
1 files changed, 68 insertions, 0 deletions
diff --git a/sapi/cli/tests/php_cli_server_019.phpt b/sapi/cli/tests/php_cli_server_019.phpt
new file mode 100644
index 000000000..2b983e5c0
--- /dev/null
+++ b/sapi/cli/tests/php_cli_server_019.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Implement Req #65917 (getallheaders() is not supported by the built-in web server)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+include "php_cli_server.inc";
+php_cli_server_start(<<<'PHP'
+header('Bar-Foo: Foo');
+var_dump(getallheaders());
+var_dump(apache_request_headers());
+var_dump(apache_response_headers());
+PHP
+);
+
+list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+$port = intval($port)?:80;
+
+$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+if (!$fp) {
+ die("connect failed");
+}
+
+if(fwrite($fp, <<<HEADER
+GET / HTTP/1.1
+Host: {$host}
+Foo-Bar: Bar
+
+
+HEADER
+)) {
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
+}
+
+fclose($fp);
+?>
+--EXPECTF--
+HTTP/1.1 200 OK
+Host: %s
+Connection: close
+X-Powered-By: %s
+Bar-Foo: Foo
+Content-type: text/html
+
+array(2) {
+ ["Host"]=>
+ string(9) "localhost"
+ ["Foo-Bar"]=>
+ string(3) "Bar"
+}
+array(2) {
+ ["Host"]=>
+ string(9) "localhost"
+ ["Foo-Bar"]=>
+ string(3) "Bar"
+}
+array(3) {
+ ["X-Powered-By"]=>
+ string(%d) "P%s"
+ ["Bar-Foo"]=>
+ string(3) "Foo"
+ ["Content-type"]=>
+ string(9) "text/html"
+}