Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ PHP 8.6 UPGRADE NOTES
3. Changes in SAPI modules
========================================

- CLI:
. The built-in development server now accepts requests using the QUERY HTTP
method instead of returning 501 Not Implemented.

========================================
4. Deprecated Functionality
========================================
Expand Down
2 changes: 2 additions & 0 deletions sapi/cli/php_http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ static const char *method_strings[] =
, "POST"
, "PUT"
, "PATCH"
, "QUERY"
, "CONNECT"
, "OPTIONS"
, "TRACE"
Expand Down Expand Up @@ -521,6 +522,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
case 'N': parser->method = PHP_HTTP_NOTIFY; break;
case 'O': parser->method = PHP_HTTP_OPTIONS; break;
case 'P': parser->method = PHP_HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
case 'Q': parser->method = PHP_HTTP_QUERY; break;
case 'R': parser->method = PHP_HTTP_REPORT; break;
case 'S': parser->method = PHP_HTTP_SUBSCRIBE; /* or SEARCH */ break;
case 'T': parser->method = PHP_HTTP_TRACE; break;
Expand Down
1 change: 1 addition & 0 deletions sapi/cli/php_http_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ enum php_http_method
, PHP_HTTP_POST
, PHP_HTTP_PUT
, PHP_HTTP_PATCH
, PHP_HTTP_QUERY
/* pathological */
, PHP_HTTP_CONNECT
, PHP_HTTP_OPTIONS
Expand Down
40 changes: 40 additions & 0 deletions sapi/cli/tests/php_cli_server_query_method.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--TEST--
Support HTTP QUERY method
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start(<<<'PHP'
var_dump($_SERVER['REQUEST_METHOD']);
PHP
);

$host = PHP_CLI_SERVER_HOSTNAME;
$fp = php_cli_server_connect();

if (fwrite($fp, <<<HEADER
QUERY / HTTP/1.1
Host: {$host}


HEADER
)) {
while (!feof($fp)) {
echo fgets($fp);
}
}

fclose($fp);
?>
--EXPECTF--
HTTP/1.1 200 OK
Host: %s
Date: %s
Connection: close
X-Powered-By: %s
Content-type: text/html; charset=UTF-8

string(5) "QUERY"
Loading