diff options
Diffstat (limited to 'ext/soap/tests/bug73037.phpt')
-rw-r--r-- | ext/soap/tests/bug73037.phpt | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/ext/soap/tests/bug73037.phpt b/ext/soap/tests/bug73037.phpt index dd5b5aa13b..d835f2a280 100644 --- a/ext/soap/tests/bug73037.phpt +++ b/ext/soap/tests/bug73037.phpt @@ -20,46 +20,46 @@ include __DIR__ . "/../../../sapi/cli/tests/php_cli_server.inc"; function get_data($max) { - $piece = "<CD> - <TITLE>Empire Burlesque</TITLE> - <ARTIST>Bob Dylan</ARTIST> - <COUNTRY>USA</COUNTRY> - <COMPANY>Columbia</COMPANY> - <PRICE>10.90</PRICE> - <YEAR>1985</YEAR> - </CD>"; - - $begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>'; - $end = '</CATALOG></soapenv:Body></soapenv:Envelope>'; - - $min = strlen($begin) + strlen($piece) + strlen($end); - $max = $max < $min ? $min : $max; - - $data = $begin; - $data .= $piece; - while (strlen($data) + strlen($end) < $max) { - /* Randomize a bit, taking gzip in account. */ - $tmp = str_replace( - array( - "Empire Burlesque", - "Bob Dylan", - ), - array( - md5(uniqid()), - sha1(uniqid()), - ), - $piece - ); - - if (strlen($begin) + strlen($tmp) + strlen($end) > $max) { - break; - } - - $data .= $tmp; - } - $data .= $end; - - return $data; + $piece = "<CD> + <TITLE>Empire Burlesque</TITLE> + <ARTIST>Bob Dylan</ARTIST> + <COUNTRY>USA</COUNTRY> + <COMPANY>Columbia</COMPANY> + <PRICE>10.90</PRICE> + <YEAR>1985</YEAR> + </CD>"; + + $begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>'; + $end = '</CATALOG></soapenv:Body></soapenv:Envelope>'; + + $min = strlen($begin) + strlen($piece) + strlen($end); + $max = $max < $min ? $min : $max; + + $data = $begin; + $data .= $piece; + while (strlen($data) + strlen($end) < $max) { + /* Randomize a bit, taking gzip in account. */ + $tmp = str_replace( + array( + "Empire Burlesque", + "Bob Dylan", + ), + array( + md5(uniqid()), + sha1(uniqid()), + ), + $piece + ); + + if (strlen($begin) + strlen($tmp) + strlen($end) > $max) { + break; + } + + $data .= $tmp; + } + $data .= $end; + + return $data; } $router = "bug73037_server.php"; @@ -74,19 +74,19 @@ PHP; php_cli_server_start($code, $router, $args); foreach (array(1024-1, 1024*8-3, 1024*9+1, 1024*16-1, 1024*32-5, 1024*64+3, 1024*128-7) as $k => $i) { - echo "Iteration $k\n\n"; + echo "Iteration $k\n\n"; - /* with and without compression */ - foreach (array(false, true) as $b) { - $data = get_data($i); - if ($b) { - $data = gzencode($data); - } - $len = strlen($data); + /* with and without compression */ + foreach (array(false, true) as $b) { + $data = get_data($i); + if ($b) { + $data = gzencode($data); + } + $len = strlen($data); - //echo "len=$len\n"; + //echo "len=$len\n"; - $hdrs = <<<HDRS + $hdrs = <<<HDRS POST /bug73037_server.php HTTP/1.1 Content-Type: application/soap+xml; charset=UTF-8 Accept: application/soap+xml, application/dime, multipart/related, text/* @@ -94,41 +94,41 @@ SOAPAction: "urn:adressen#adressen#SetAda" Expect: 100-continue Content-Length: ${len} HDRS; - if ($b) { - $hdrs .="\nContent-Encoding: gzip"; - } - //echo "Headers sent:\n$hdrs\n\n"; - $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5); - if (!$fp) { - die("connect failed"); - } - - if(fwrite($fp, "$hdrs\n\n$data")) { - $out = ""; - while (!feof($fp)) { - $out .= fread($fp, 1024); - } - - $pos = strpos($out, "<env:Text>"); - if (false === $pos) { - echo $out; - goto cleanup; - } - $pos0 = $pos + strlen("<env:Text>"); - $pos = strpos($out, "</env:Text>"); - if (false === $pos) { - echo $out; - goto cleanup; - } - $len = $pos - $pos0; - echo substr($out, $pos0, $len); - } + if ($b) { + $hdrs .="\nContent-Encoding: gzip"; + } + //echo "Headers sent:\n$hdrs\n\n"; + $fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5); + if (!$fp) { + die("connect failed"); + } + + if(fwrite($fp, "$hdrs\n\n$data")) { + $out = ""; + while (!feof($fp)) { + $out .= fread($fp, 1024); + } + + $pos = strpos($out, "<env:Text>"); + if (false === $pos) { + echo $out; + goto cleanup; + } + $pos0 = $pos + strlen("<env:Text>"); + $pos = strpos($out, "</env:Text>"); + if (false === $pos) { + echo $out; + goto cleanup; + } + $len = $pos - $pos0; + echo substr($out, $pos0, $len); + } cleanup: - fclose($fp); + fclose($fp); - echo "\n\n"; - } + echo "\n\n"; + } } ?> |