Skip to content

Commit

Permalink
Comments: Add support for all HTTP protocol versions when returning a…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
johnbillion committed Aug 29, 2016
1 parent 56bc1dc commit a96f20f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion wp-comments-post.php
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -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.
Expand Down

0 comments on commit a96f20f

Please sign in to comment.