Annotation of embedaddon/php/sapi/cli/tests/php_cli_server_009.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PATH_INFO (relevant to #60112)
3: --DESCRIPTION--
4: After this fix(#60112), previously 404 request like "localhost/foo/bar"
5: now could serve correctly with request_uri "index.php" and PATH_INFO "/foo/bar/"
6: --SKIPIF--
7: <?php
8: include "skipif.inc";
9: ?>
10: --FILE--
11: <?php
12: include "php_cli_server.inc";
13: php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', TRUE);
14:
15: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
16: $port = intval($port)?:80;
17:
18: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
19: if (!$fp) {
20: die("connect failed");
21: }
22:
23: if(fwrite($fp, <<<HEADER
24: GET /foo/bar HTTP/1.1
25: Host: {$host}
26:
27:
28: HEADER
29: )) {
30: while (!feof($fp)) {
31: echo fgets($fp);
32: }
33: }
34:
35: fclose($fp);
36:
37: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
38: if (!$fp) {
39: die("connect failed");
40: }
41:
42:
43: if(fwrite($fp, <<<HEADER
44: GET /foo/bar/ HTTP/1.0
45: Host: {$host}
46:
47:
48: HEADER
49: )) {
50: while (!feof($fp)) {
51: echo fgets($fp);
52: }
53: }
54:
55: fclose($fp);
56:
57: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
58: if (!$fp) {
59: die("connect failed");
60: }
61:
62:
63: if(fwrite($fp, <<<HEADER
64: GET /foo/bar.js HTTP/1.0
65: Host: {$host}
66:
67:
68: HEADER
69: )) {
70: while (!feof($fp)) {
71: echo fgets($fp);
72: break;
73: }
74: }
75:
76: fclose($fp);
77: ?>
78: --EXPECTF--
79: HTTP/1.1 200 OK
80: Host: %s
81: Connection: close
82: X-Powered-By: PHP/%s
83: Content-type: text/html
84:
85: string(8) "/foo/bar"
86: HTTP/1.0 200 OK
87: Host: %s
88: Connection: close
89: X-Powered-By: PHP/%s
90: Content-type: text/html
91:
92: string(9) "/foo/bar/"
93: HTTP/1.0 404 Not Found
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>