From a96f20f9b5e0807040c8e979274c74f952a75a10 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Mon, 29 Aug 2016 12:00:32 +0000 Subject: [PATCH] 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 --- wp-comments-post.php | 7 ++++++- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-comments-post.php b/wp-comments-post.php index 4e9f1fcfb0..2c421d327a 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -6,8 +6,13 @@ */ 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('HTTP/1.1 405 Method Not Allowed'); + header("$protocol 405 Method Not Allowed"); header('Content-Type: text/plain'); exit; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 8c0f96cf54..bd5a8ac3da 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.