diff --git a/UPGRADING b/UPGRADING index b9c659ccc405..6a1f1b12e4a8 100644 --- a/UPGRADING +++ b/UPGRADING @@ -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 ======================================== diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c index c7c2ad0caaea..ac3c19d5d963 100644 --- a/sapi/cli/php_http_parser.c +++ b/sapi/cli/php_http_parser.c @@ -82,6 +82,7 @@ static const char *method_strings[] = , "POST" , "PUT" , "PATCH" + , "QUERY" , "CONNECT" , "OPTIONS" , "TRACE" @@ -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; diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h index 345ca405edd0..d7006b6d04d7 100644 --- a/sapi/cli/php_http_parser.h +++ b/sapi/cli/php_http_parser.h @@ -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 diff --git a/sapi/cli/tests/php_cli_server_query_method.phpt b/sapi/cli/tests/php_cli_server_query_method.phpt new file mode 100644 index 000000000000..58ce95bfd1e3 --- /dev/null +++ b/sapi/cli/tests/php_cli_server_query_method.phpt @@ -0,0 +1,40 @@ +--TEST-- +Support HTTP QUERY method +--SKIPIF-- + +--FILE-- + +--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"