Annotation of embedaddon/php/sapi/cli/tests/php_cli_server_014.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #60477: Segfault after two multipart/form-data POST requestes
        !             3: --SKIPIF--
        !             4: <?php
        !             5: include "skipif.inc"; 
        !             6: ?>
        !             7: --FILE--
        !             8: <?php
        !             9: include "php_cli_server.inc";
        !            10: php_cli_server_start('echo done, "\n";', 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: if(fwrite($fp, <<<HEADER
        !            22: POST /index.php HTTP/1.1
        !            23: Host: {$host}
        !            24: Content-Type: multipart/form-data; boundary=---------123456789
        !            25: Content-Length: 70
        !            26: 
        !            27: ---------123456789
        !            28: Content-Type: application/x-www-form-urlencoded
        !            29: a=b
        !            30: HEADER
        !            31: )) {
        !            32:        while (!feof($fp)) {
        !            33:                $output .= fgets($fp);
        !            34:        }
        !            35: }
        !            36: 
        !            37: fclose($fp);
        !            38: 
        !            39: $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
        !            40: if(fwrite($fp, <<<HEADER
        !            41: POST /main/no-exists.php HTTP/1.1
        !            42: Host: {$host}
        !            43: Content-Type: multipart/form-data; boundary=---------123456789
        !            44: Content-Length: 70
        !            45: 
        !            46: ---------123456789
        !            47: Content-Type: application/x-www-form-urlencoded
        !            48: a=b
        !            49: HEADER
        !            50: )) {
        !            51:        while (!feof($fp)) {
        !            52:                $output .= fgets($fp);
        !            53:        }
        !            54: }
        !            55: 
        !            56: echo preg_replace("/<style type=\"text\/css\">(.*?)<\/style>/s", "<style type=\"text/css\">AAA</style>", $output), "\n";
        !            57: fclose($fp);
        !            58: 
        !            59: ?>
        !            60: --EXPECTF--
        !            61: 
        !            62: HTTP/1.1 200 OK
        !            63: Host: %s
        !            64: Connection: close
        !            65: X-Powered-By: %s
        !            66: Content-type: %s
        !            67: 
        !            68: done
        !            69: HTTP/1.1 404 Not Found
        !            70: Host: %s
        !            71: Connection: close
        !            72: Content-Type: %s
        !            73: Content-Length: %d
        !            74: 
        !            75: <html><head><title>404 Not Found</title><style type="text/css">AAA</style>
        !            76: </head><body><h1 class="h">Not Found</h1><p>The requested resource /main/no-exists.php was not found on this server.</p></body></html>

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