com php-src: Fixed bug #69953: NEWS sapi/cli/php_http_parse r.c sapi/cli/php_http_parser.h sapi/cli/tests/bug 69655.phpt sapi/cli/tests/bug69953.ph pt

From: Date: Thu, 03 Mar 2016 18:22:38 +0000
Subject: com php-src: Fixed bug #69953: NEWS sapi/cli/php_http_parse r.c sapi/cli/php_http_parser.h sapi/cli/tests/bug 69655.phpt sapi/cli/tests/bug69953.ph pt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91273@lists.php.net to get a copy of this message
Commit: 2d4ad66ff2e9f64e23461325f3c73bd5791653c2 Author: Christoph M. Becker <cmbecker69@gmx.de> Tue, 14 Jul 2015 11:09:03 +0200 Committer: Nikita Popov <nikic@php.net> Thu, 3 Mar 2016 19:22:38 +0100 Parents: ccd215a51788dd8971baf47ea90224888b3a022f Branches: PHP-5.6 PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2d4ad66ff2e9f64e23461325f3c73bd5791653c2 Log: Fixed bug #69953 Added support for MKCALENDAR request method in CLI web server. Bugs: https://bugs.php.net/69953 Changed paths: M NEWS M sapi/cli/php_http_parser.c M sapi/cli/php_http_parser.h M sapi/cli/tests/bug69655.phpt A sapi/cli/tests/bug69953.phpt Diff: diff --git a/NEWS b/NEWS index 96bbcb6..cf0cb05 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2016, PHP 5.6.20 +- CLI Server: + . Fixed bug #69953 (Support MKCALENDAR request method). (Christoph) + - Core: . Fixed bug #71596 (Segmentation fault on ZTS with date function (setlocale)). (Anatol) diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c index 73c6d4c..7173032 100644 --- a/sapi/cli/php_http_parser.c +++ b/sapi/cli/php_http_parser.c @@ -89,6 +89,7 @@ static const char *method_strings[] = , "LOCK" , "MKCOL" , "MOVE" + , "MKCALENDAR" , "PROPFIND" , "PROPPATCH" , "UNLOCK" @@ -583,7 +584,7 @@ size_t php_http_parser_execute (php_http_parser *parser, case 'G': parser->method = PHP_HTTP_GET; break; case 'H': parser->method = PHP_HTTP_HEAD; break; case 'L': parser->method = PHP_HTTP_LOCK; break; - case 'M': parser->method = PHP_HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH */ break; + case 'M': parser->method = PHP_HTTP_MKCOL; /* or MOVE, MKCALENDAR, MKACTIVITY, MERGE, M-SEARCH */ break; 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; @@ -622,6 +623,8 @@ size_t php_http_parser_execute (php_http_parser *parser, } else if (parser->method == PHP_HTTP_MKCOL) { if (index == 1 && ch == 'O') { parser->method = PHP_HTTP_MOVE; + } else if (index == 3 && ch == 'A') { + parser->method = PHP_HTTP_MKCALENDAR; } else if (index == 1 && ch == 'E') { parser->method = PHP_HTTP_MERGE; } else if (index == 1 && ch == '-') { diff --git a/sapi/cli/php_http_parser.h b/sapi/cli/php_http_parser.h index 31502e2..f2e1246 100644 --- a/sapi/cli/php_http_parser.h +++ b/sapi/cli/php_http_parser.h @@ -88,6 +88,7 @@ enum php_http_method , PHP_HTTP_LOCK , PHP_HTTP_MKCOL , PHP_HTTP_MOVE + , PHP_HTTP_MKCALENDAR , PHP_HTTP_PROPFIND , PHP_HTTP_PROPPATCH , PHP_HTTP_UNLOCK diff --git a/sapi/cli/tests/bug69655.phpt b/sapi/cli/tests/bug69655.phpt index 188b9c3..73791c9 100644 --- a/sapi/cli/tests/bug69655.phpt +++ b/sapi/cli/tests/bug69655.phpt @@ -10,7 +10,7 @@ include "skipif.inc"; <?php include "php_cli_server.inc"; php_cli_server_start(); -foreach (['MKCALENDAR', 'MKCO', 'MKCOLL', 'M'] as $method) { +foreach (['MKCO', 'MKCOLL', 'M'] as $method) { $context = stream_context_create(['http' => ['method' => $method]]); // the following is supposed to emit a warning for unsupported methods file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS, false, $context); @@ -25,6 +25,3 @@ Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP r Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented in %s on line %d - -Warning: file_get_contents(http://localhost:8964): failed to open stream: HTTP request failed! HTTP/1.0 501 Not Implemented - in %s on line %d diff --git a/sapi/cli/tests/bug69953.phpt b/sapi/cli/tests/bug69953.phpt new file mode 100644 index 0000000..4de41fe --- /dev/null +++ b/sapi/cli/tests/bug69953.phpt @@ -0,0 +1,17 @@ +--TEST-- +FR #69953 (Support MKCALENDAR request method) +--INI-- +allow_url_fopen=1 +--SKIPIF-- +<?php +include "skipif.inc"; +?> +--FILE-- +<?php +include "php_cli_server.inc"; +php_cli_server_start('echo $_SERVER["REQUEST_METHOD"];'); +$context = stream_context_create(['http' => ['method' => 'MKCALENDAR']]); +var_dump(file_get_contents("http://" . PHP_CLI_SERVER_ADDRESS, false, $context)); +?> +--EXPECT-- +string(10) "MKCALENDAR"

« previous php.cvs (#91273) next »