Comments: Add support for all HTTP protocol versions when returning a 405 from `wp-comments-post.php`.

Fixes #37863
Props tnash

Built from https://develop.svn.wordpress.org/trunk@38432


git-svn-id: http://core.svn.wordpress.org/trunk@38373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2016-08-29 12:00:32 +00:00
parent 56bc1dc194
commit a96f20f9b5
2 changed files with 7 additions and 2 deletions

View File

@ -6,8 +6,13 @@
*/ */
if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) { if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
$protocol = $_SERVER['SERVER_PROTOCOL'];
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
$protocol = 'HTTP/1.0';
}
header('Allow: POST'); header('Allow: POST');
header('HTTP/1.1 405 Method Not Allowed'); header("$protocol 405 Method Not Allowed");
header('Content-Type: text/plain'); header('Content-Type: text/plain');
exit; exit;
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-alpha-38431'; $wp_version = '4.7-alpha-38432';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.