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

Fixes #37863
Props tnash


git-svn-id: https://develop.svn.wordpress.org/trunk@38432 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2016-08-29 11:59:45 +00:00
parent 9d70a4495d
commit 6b23bbb92b
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}