mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'PHP-7.4'
* PHP-7.4: Add php_cli_server_connect() helper
This commit is contained in:
commit
b0d8f012f9
33 changed files with 83 additions and 251 deletions
|
@ -35,15 +35,10 @@ php_cli_server_start(<<<'SCRIPT'
|
||||||
SCRIPT
|
SCRIPT
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
|
||||||
|
|
||||||
foreach(array("parse", "fatal", "fatal2", "compile") as $url) {
|
foreach(array("parse", "fatal", "fatal2", "compile") as $url) {
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /$url HTTP/1.1
|
GET /$url HTTP/1.1
|
||||||
Host: {$host}
|
Host: {$host}
|
||||||
|
|
|
@ -12,13 +12,8 @@ echo "This should never echo";
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send a request with a fictitious request method,
|
// Send a request with a fictitious request method,
|
||||||
// I like smurfs, the smurf everything.
|
// I like smurfs, the smurf everything.
|
||||||
|
|
|
@ -17,9 +17,8 @@ $mimetypes = ['html', 'htm', 'svg', 'css', 'js', 'png', 'webm', 'ogv', 'ogg'];
|
||||||
|
|
||||||
function test_mimetypes($mimetypes) {
|
function test_mimetypes($mimetypes) {
|
||||||
foreach ($mimetypes as $mimetype) {
|
foreach ($mimetypes as $mimetype) {
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port) ? : 80;
|
$fp = php_cli_server_connect();
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) die('Connect failed');
|
if (!$fp) die('Connect failed');
|
||||||
file_put_contents(__DIR__ . "/foo.{$mimetype}", '');
|
file_put_contents(__DIR__ . "/foo.{$mimetype}", '');
|
||||||
$header = <<<HEADER
|
$header = <<<HEADER
|
||||||
|
|
|
@ -11,13 +11,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('http_response_code(100);');
|
php_cli_server_start('http_response_code(100);');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -11,13 +11,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('http_response_code(422);');
|
php_cli_server_start('http_response_code(422);');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -11,13 +11,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('http_response_code(511);');
|
php_cli_server_start('http_response_code(511);');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -12,13 +12,8 @@ var_dump($_COOKIE, $_SERVER['HTTP_FOO']);
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -11,13 +11,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump($_SERVER["CONTENT_TYPE"], $_SERVER["CONTENT_LENGTH"])');
|
php_cli_server_start('var_dump($_SERVER["CONTENT_TYPE"], $_SERVER["CONTENT_LENGTH"])');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fwrite($fp, <<<HEADER
|
if (fwrite($fp, <<<HEADER
|
||||||
POST /index.php HTTP/1.1
|
POST /index.php HTTP/1.1
|
||||||
|
|
|
@ -12,13 +12,8 @@ header(' ');
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -13,13 +13,8 @@ http_response_code(308);
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -13,13 +13,8 @@ http_response_code(426);
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -9,13 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump(count($_SERVER));', 'not-index.php');
|
php_cli_server_start('var_dump(count($_SERVER));', 'not-index.php');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, "GET www.example.com:80 HTTP/1.1\r\n\r\n")) {
|
if(fwrite($fp, "GET www.example.com:80 HTTP/1.1\r\n\r\n")) {
|
||||||
while (!feof($fp)) {
|
while (!feof($fp)) {
|
||||||
|
|
|
@ -9,11 +9,7 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start("var_dump(getAllheaders());");
|
php_cli_server_start("var_dump(getAllheaders());");
|
||||||
|
|
||||||
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed: " . $errmsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
fwrite($fp, "GET / HTTP/1.1\r\n");
|
fwrite($fp, "GET / HTTP/1.1\r\n");
|
||||||
fwrite($fp, "Host: " . PHP_CLI_SERVER_HOSTNAME . "\r\n");
|
fwrite($fp, "Host: " . PHP_CLI_SERVER_HOSTNAME . "\r\n");
|
||||||
|
|
|
@ -15,13 +15,8 @@ EOF;
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start($code);
|
php_cli_server_start($code);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port) ?: 80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -9,11 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start("var_dump(getAllheaders());");
|
php_cli_server_start("var_dump(getAllheaders());");
|
||||||
|
|
||||||
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errmsg, 0.5);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed: " . $errmsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
fwrite($fp, "GET / HTTP/1.1\r\nUser-Agent\r\nAccept: */*\r\nReferer:\r\nHi\r\n\r\n");
|
fwrite($fp, "GET / HTTP/1.1\r\nUser-Agent\r\nAccept: */*\r\nReferer:\r\nHi\r\n\r\n");
|
||||||
fflush($fp);
|
fflush($fp);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
define ("PHP_CLI_SERVER_HOSTNAME", "localhost");
|
define("PHP_CLI_SERVER_HOSTNAME", "localhost");
|
||||||
define ("PHP_CLI_SERVER_PORT", 8964);
|
define("PHP_CLI_SERVER_PORT", 8964);
|
||||||
define ("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
|
define("PHP_CLI_SERVER_ADDRESS", PHP_CLI_SERVER_HOSTNAME.":".PHP_CLI_SERVER_PORT);
|
||||||
|
|
||||||
function php_cli_server_start(
|
function php_cli_server_start(
|
||||||
?string $code = 'echo "Hello world";',
|
?string $code = 'echo "Hello world";',
|
||||||
|
@ -96,4 +96,14 @@ php_cli_server_start_error:
|
||||||
|
|
||||||
return $handle;
|
return $handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function php_cli_server_connect() {
|
||||||
|
$timeout = 1.0;
|
||||||
|
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, $timeout);
|
||||||
|
if (!$fp) {
|
||||||
|
die("connect failed");
|
||||||
|
}
|
||||||
|
return $fp;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -11,13 +11,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('foreach($_SERVER as $k=>$v) { if (!strncmp($k, "HTTP", 4)) var_dump( $k . ":" . $v); }');
|
php_cli_server_start('foreach($_SERVER as $k=>$v) { if (!strncmp($k, "HTTP", 4)) var_dump( $k . ":" . $v); }');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -9,13 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump($_FILES);');
|
php_cli_server_start('var_dump($_FILES);');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
$post_data = <<<POST
|
$post_data = <<<POST
|
||||||
-----------------------------114782935826962
|
-----------------------------114782935826962
|
||||||
|
|
|
@ -9,13 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]);');
|
php_cli_server_start('var_dump($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]);');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -9,13 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('header(\'WWW-Authenticate: Digest realm="foo",qop="auth",nonce="XXXXX",opaque="'.md5("foo").'"\');');
|
php_cli_server_start('header(\'WWW-Authenticate: Digest realm="foo",qop="auth",nonce="XXXXX",opaque="'.md5("foo").'"\');');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -9,13 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump($_SERVER["SERVER_PROTOCOL"]);');
|
php_cli_server_start('var_dump($_SERVER["SERVER_PROTOCOL"]);');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
@ -31,11 +26,7 @@ HEADER
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.0
|
GET / HTTP/1.0
|
||||||
|
|
|
@ -12,13 +12,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', null);
|
php_cli_server_start('var_dump($_SERVER["PATH_INFO"]);', null);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /foo/bar HTTP/1.1
|
GET /foo/bar HTTP/1.1
|
||||||
|
@ -34,11 +29,7 @@ HEADER
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /foo/bar/ HTTP/1.0
|
GET /foo/bar/ HTTP/1.0
|
||||||
|
@ -54,11 +45,7 @@ HEADER
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /foo/bar.js HTTP/1.0
|
GET /foo/bar.js HTTP/1.0
|
||||||
|
|
|
@ -9,13 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', null);
|
php_cli_server_start('var_dump($_SERVER["PHP_SELF"], $_SERVER["SCRIPT_NAME"], $_SERVER["PATH_INFO"], $_SERVER["QUERY_STRING"]);', null);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /foo/bar?foo=bar HTTP/1.1
|
GET /foo/bar?foo=bar HTTP/1.1
|
||||||
|
@ -31,11 +26,7 @@ HEADER
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /index.php/foo/bar/?foo=bar HTTP/1.0
|
GET /index.php/foo/bar/?foo=bar HTTP/1.0
|
||||||
|
|
|
@ -11,13 +11,8 @@ php_cli_server_start('print_r($_REQUEST); $_REQUEST["foo"] = "bar"; return FALSE
|
||||||
$doc_root = __DIR__;
|
$doc_root = __DIR__;
|
||||||
file_put_contents($doc_root . '/request.php', '<?php print_r($_REQUEST); ?>');
|
file_put_contents($doc_root . '/request.php', '<?php print_r($_REQUEST); ?>');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
POST /request.php HTTP/1.1
|
POST /request.php HTTP/1.1
|
||||||
|
|
|
@ -9,15 +9,10 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start(NULL, NULL);
|
php_cli_server_start(NULL, NULL);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
|
||||||
$port = intval($port)?:80;
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
if (!$fp) {
|
$fp = php_cli_server_connect();
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
POST / HTTP/1.1
|
POST / HTTP/1.1
|
||||||
|
@ -38,10 +33,7 @@ fclose($fp);
|
||||||
|
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /main/style.css HTTP/1.1
|
GET /main/style.css HTTP/1.1
|
||||||
|
@ -59,10 +51,7 @@ echo preg_replace("/<style>(.*?)<\/style>/s", "<style>AAA</style>", $output), "\
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
HEAD /main/foo/bar HTTP/1.1
|
HEAD /main/foo/bar HTTP/1.1
|
||||||
|
|
|
@ -9,18 +9,9 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('echo "done\n";', null);
|
php_cli_server_start('echo "done\n";', null);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
|
||||||
$port = intval($port)?:80;
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
// note: select() on Windows (& some other platforms) has historical issues with
|
$fp = php_cli_server_connect();
|
||||||
// timeouts less than 1000 millis(0.5). it may be better to increase these
|
|
||||||
// timeouts to 1000 millis(1.0) (fsockopen eventually calls select()).
|
|
||||||
// see articles like: http://support.microsoft.com/kb/257821
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
POST /index.php HTTP/1.1
|
POST /index.php HTTP/1.1
|
||||||
|
@ -40,7 +31,7 @@ HEADER
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
POST /main/no-exists.php HTTP/1.1
|
POST /main/no-exists.php HTTP/1.1
|
||||||
Host: {$host}
|
Host: {$host}
|
||||||
|
|
|
@ -14,14 +14,9 @@ $dir = realpath(__DIR__);
|
||||||
|
|
||||||
file_put_contents($dir . "/syntax_error.php", "<?php non_exists_function(); ?>");
|
file_put_contents($dir . "/syntax_error.php", "<?php non_exists_function(); ?>");
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
|
||||||
$port = intval($port)?:80;
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$fp = php_cli_server_connect();
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET /index.php HTTP/1.1
|
GET /index.php HTTP/1.1
|
||||||
|
|
|
@ -19,13 +19,8 @@ else {
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
POST /no-exists.jpg HTTP/1.1
|
POST /no-exists.jpg HTTP/1.1
|
||||||
|
|
|
@ -12,13 +12,8 @@ var_dump($_SERVER['SCRIPT_FILENAME']);
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
POST / HTTP/1.1
|
POST / HTTP/1.1
|
||||||
|
|
|
@ -12,13 +12,8 @@ var_dump($_SERVER['REQUEST_METHOD']);
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
PATCH / HTTP/1.1
|
PATCH / HTTP/1.1
|
||||||
|
|
|
@ -15,13 +15,8 @@ var_dump(apache_response_headers());
|
||||||
PHP
|
PHP
|
||||||
);
|
);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port)?:80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
GET / HTTP/1.1
|
GET / HTTP/1.1
|
||||||
|
|
|
@ -9,13 +9,8 @@ include "skipif.inc";
|
||||||
include "php_cli_server.inc";
|
include "php_cli_server.inc";
|
||||||
php_cli_server_start('var_dump($_SERVER["REQUEST_METHOD"]);');
|
php_cli_server_start('var_dump($_SERVER["REQUEST_METHOD"]);');
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
$port = intval($port) ?: 80;
|
$fp = php_cli_server_connect();
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
|
||||||
if (!$fp) {
|
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(fwrite($fp, <<<HEADER
|
if(fwrite($fp, <<<HEADER
|
||||||
SEARCH / HTTP/1.1
|
SEARCH / HTTP/1.1
|
||||||
|
|
|
@ -46,15 +46,11 @@ include "php_cli_server.inc";
|
||||||
php_cli_server_start("var_dump(\$_FILES);", null,
|
php_cli_server_start("var_dump(\$_FILES);", null,
|
||||||
["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]);
|
["-d", "post_max_size=3G", "-d", "upload_max_filesize=3G"]);
|
||||||
|
|
||||||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
|
|
||||||
$port = intval($port)?:80;
|
|
||||||
$length = 2150000000;
|
$length = 2150000000;
|
||||||
$output = "";
|
$output = "";
|
||||||
|
|
||||||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5);
|
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||||
if (!$fp) {
|
$fp = php_cli_server_connect();
|
||||||
die("connect failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
$prev = "----123
|
$prev = "----123
|
||||||
Content-Type: text/plain; charset=UTF-8
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue