Browse Source
Merge branch 'PHP-5.4' into PHP-5.5
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fix the spelling of the php_cli_server_http_response_status_code_pair typedef. Change the search in get_status_string() to correctly handle unknown codes.pull/376/head
5 changed files with 157 additions and 18 deletions
-
6NEWS
-
52sapi/cli/php_cli_server.c
-
39sapi/cli/tests/bug65066_100.phpt
-
39sapi/cli/tests/bug65066_422.phpt
-
39sapi/cli/tests/bug65066_511.phpt
@ -0,0 +1,39 @@ |
|||
--TEST-- |
|||
Bug #65066 (Cli server not responsive when responding with 422 http status code): 100 status code |
|||
--INI-- |
|||
allow_url_fopen=1 |
|||
--SKIPIF-- |
|||
<?php |
|||
include "skipif.inc"; |
|||
?> |
|||
--FILE-- |
|||
<?php |
|||
include "php_cli_server.inc"; |
|||
php_cli_server_start('http_response_code(100);'); |
|||
|
|||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); |
|||
$port = intval($port)?:80; |
|||
|
|||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5); |
|||
if (!$fp) { |
|||
die("connect failed"); |
|||
} |
|||
|
|||
if(fwrite($fp, <<<HEADER |
|||
GET / HTTP/1.1 |
|||
Host: {$host} |
|||
|
|||
|
|||
HEADER |
|||
)) { |
|||
while (!feof($fp)) { |
|||
echo fgets($fp); |
|||
} |
|||
} |
|||
?> |
|||
--EXPECTF-- |
|||
HTTP/1.1 100 Continue |
|||
Host: %s |
|||
Connection: close |
|||
X-Powered-By: PHP/%s |
|||
Content-type: text/html |
|||
@ -0,0 +1,39 @@ |
|||
--TEST-- |
|||
Bug #65066 (Cli server not responsive when responding with 422 http status code): 422 status code |
|||
--INI-- |
|||
allow_url_fopen=1 |
|||
--SKIPIF-- |
|||
<?php |
|||
include "skipif.inc"; |
|||
?> |
|||
--FILE-- |
|||
<?php |
|||
include "php_cli_server.inc"; |
|||
php_cli_server_start('http_response_code(422);'); |
|||
|
|||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); |
|||
$port = intval($port)?:80; |
|||
|
|||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5); |
|||
if (!$fp) { |
|||
die("connect failed"); |
|||
} |
|||
|
|||
if(fwrite($fp, <<<HEADER |
|||
GET / HTTP/1.1 |
|||
Host: {$host} |
|||
|
|||
|
|||
HEADER |
|||
)) { |
|||
while (!feof($fp)) { |
|||
echo fgets($fp); |
|||
} |
|||
} |
|||
?> |
|||
--EXPECTF-- |
|||
HTTP/1.1 422 Unknown Status Code |
|||
Host: %s |
|||
Connection: close |
|||
X-Powered-By: PHP/%s |
|||
Content-type: text/html |
|||
@ -0,0 +1,39 @@ |
|||
--TEST-- |
|||
Bug #65066 (Cli server not responsive when responding with 422 http status code): 511 status code |
|||
--INI-- |
|||
allow_url_fopen=1 |
|||
--SKIPIF-- |
|||
<?php |
|||
include "skipif.inc"; |
|||
?> |
|||
--FILE-- |
|||
<?php |
|||
include "php_cli_server.inc"; |
|||
php_cli_server_start('http_response_code(511);'); |
|||
|
|||
list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS); |
|||
$port = intval($port)?:80; |
|||
|
|||
$fp = fsockopen($host, $port, $errno, $errstr, 0.5); |
|||
if (!$fp) { |
|||
die("connect failed"); |
|||
} |
|||
|
|||
if(fwrite($fp, <<<HEADER |
|||
GET / HTTP/1.1 |
|||
Host: {$host} |
|||
|
|||
|
|||
HEADER |
|||
)) { |
|||
while (!feof($fp)) { |
|||
echo fgets($fp); |
|||
} |
|||
} |
|||
?> |
|||
--EXPECTF-- |
|||
HTTP/1.1 511 Network Authentication Required |
|||
Host: %s |
|||
Connection: close |
|||
X-Powered-By: PHP/%s |
|||
Content-type: text/html |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue