Annotation of embedaddon/php/sapi/cli/tests/php_cli_server_013.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: No router, no script
                      3: --SKIPIF--
                      4: <?php
                      5: include "skipif.inc"; 
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: include "php_cli_server.inc";
                     10: php_cli_server_start(NULL, TRUE);
                     11: 
                     12: list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
                     13: $port = intval($port)?:80;
                     14: $output = '';
                     15: 
                     16: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
                     17: if (!$fp) {
                     18:   die("connect failed");
                     19: }
                     20: 
                     21: 
                     22: if(fwrite($fp, <<<HEADER
                     23: POST / HTTP/1.1
                     24: Host: {$host}
                     25: Content-Type: application/x-www-form-urlencoded
                     26: Content-Length: 3
                     27: 
                     28: a=b
                     29: HEADER
                     30: )) {
                     31:        while (!feof($fp)) {
                     32:                $output .= fgets($fp);
                     33:        }
                     34: }
                     35: 
                     36: echo preg_replace("/<style type=\"text\/css\">(.*?)<\/style>/s", "<style type=\"text/css\">AAA</style>", $output), "\n";
                     37: fclose($fp);
                     38: 
                     39: 
                     40: $output = '';
                     41: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
                     42: if (!$fp) {
                     43:   die("connect failed");
                     44: }
                     45: 
                     46: if(fwrite($fp, <<<HEADER
                     47: GET /main/style.css HTTP/1.1
                     48: Host: {$host}
                     49: 
                     50: 
                     51: HEADER
                     52: )) {
                     53:        while (!feof($fp)) {
                     54:                $output .= fgets($fp);
                     55:        }
                     56: }
                     57: 
                     58: echo preg_replace("/<style type=\"text\/css\">(.*?)<\/style>/s", "<style type=\"text/css\">AAA</style>", $output), "\n";
                     59: fclose($fp);
                     60: 
                     61: $output = '';
                     62: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
                     63: if (!$fp) {
                     64:   die("connect failed");
                     65: }
                     66: 
                     67: if(fwrite($fp, <<<HEADER
                     68: HEAD /main/foo/bar HTTP/1.1
                     69: Host: {$host}
                     70: 
                     71: 
                     72: HEADER
                     73: )) {
                     74:        while (!feof($fp)) {
                     75:                $output .= fgets($fp);
                     76:        }
                     77: }
                     78: 
                     79: echo preg_replace("/<style type=\"text\/css\">(.*?)<\/style>/s", "<style type=\"text/css\">AAA</style>", $output), "\n";
                     80: fclose($fp);
                     81: ?>
                     82: --EXPECTF--
                     83: 
                     84: HTTP/1.1 404 Not Found
                     85: Host: %s
                     86: Connection: close
                     87: Content-Type: text/html; charset=UTF-8
                     88: Content-Length: %d
                     89: 
                     90: <html><head><title>404 Not Found</title><style type="text/css">AAA</style>
                     91: </head><body><h1 class="h">Not Found</h1><p>The requested resource / was not found on this server.</p></body></html>
                     92: HTTP/1.1 404 Not Found
                     93: Host: %s
                     94: Connection: close
                     95: Content-Type: text/html; charset=UTF-8
                     96: Content-Length: %d
                     97: 
                     98: <html><head><title>404 Not Found</title><style type="text/css">AAA</style>
                     99: </head><body><h1 class="h">Not Found</h1><p>The requested resource /main/style.css was not found on this server.</p></body></html>
                    100: HTTP/1.1 404 Not Found
                    101: Host: %s
                    102: Connection: close
                    103: Content-Type: text/html; charset=UTF-8
                    104: Content-Length: %d
                    105: 
                    106: <html><head><title>404 Not Found</title><style type="text/css">AAA</style>
                    107: </head><body><h1 class="h">Not Found</h1><p>The requested resource /main/foo/bar was not found on this server.</p></body></html>
                    108: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>