mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
This commit is contained in:
commit
3b461d93e1
2
NEWS
2
NEWS
@ -6,6 +6,8 @@ PHP NEWS
|
||||
. Fixed bug #72595 (php_output_handler_append illegal write access). (cmb)
|
||||
. Fixed bug #66719 (Weird behaviour when using get_called_class() with
|
||||
call_user_func()). (Nikita)
|
||||
. Fixed bug #81305 (Built-in Webserver Drops Requests With "Upgrade" Header).
|
||||
(cmb)
|
||||
|
||||
- BCMath:
|
||||
. Fixed bug #78238 (BCMath returns "-0"). (cmb)
|
||||
|
@ -1339,11 +1339,16 @@ size_t php_http_parser_execute (php_http_parser *parser,
|
||||
}
|
||||
}
|
||||
|
||||
/* We cannot meaningfully support upgrade requests, since we only
|
||||
* support HTTP/1 for now.
|
||||
*/
|
||||
#if 0
|
||||
/* Exit, the rest of the connect is in a different protocol. */
|
||||
if (parser->upgrade) {
|
||||
CALLBACK2(message_complete);
|
||||
return (p - data);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (parser->flags & F_SKIPBODY) {
|
||||
CALLBACK2(message_complete);
|
||||
|
36
sapi/cli/tests/bug81305.phpt
Normal file
36
sapi/cli/tests/bug81305.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #81305 (Built-in Webserver Drops Requests With "Upgrade" Header)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include "skipif.inc";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
include "php_cli_server.inc";
|
||||
php_cli_server_start();
|
||||
|
||||
$host = PHP_CLI_SERVER_HOSTNAME;
|
||||
$fp = php_cli_server_connect();
|
||||
|
||||
if (fwrite($fp, <<<HEADER
|
||||
GET / HTTP/1.1
|
||||
Host: {$host}
|
||||
Upgrade: HTTP/2.0
|
||||
Connection: upgrade
|
||||
|
||||
|
||||
HEADER)) {
|
||||
fpassthru($fp);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
?>
|
||||
--EXPECTF--
|
||||
HTTP/1.1 200 OK
|
||||
Host: %s
|
||||
Date: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
Hello world
|
Loading…
Reference in New Issue
Block a user