1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Files
archived-php-src/sapi/cli/tests/bug69655.phpt
Rowan Tommins f9f769d4b9 Make http stream wrapper advertise HTTP/1.1 by default
In practice, we always act as an HTTP/1.1 client, for compatibility
with servers which ignore protocol version. Sending the version in
the request will avoid problems with servers which don't ignore it.

HTTP/1.0 can still be forced using a stream context option.

Closes GH-5899.
2020-08-03 16:30:09 +02:00

28 lines
925 B
PHP

--TEST--
Bug #69655 (php -S changes MKCALENDAR request method to MKCOL)
--INI--
allow_url_fopen=1
--SKIPIF--
<?php
include "skipif.inc";
?>
--FILE--
<?php
include "php_cli_server.inc";
php_cli_server_start();
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);
}
?>
--EXPECTF--
Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d
Warning: file_get_contents(http://localhost:8964): Failed to open stream: HTTP request failed! HTTP/1.1 501 Not Implemented
in %s on line %d