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:
parent
9d70a4495d
commit
6b23bbb92b
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user