Make WordPress Core


Ignore:
Timestamp:
08/29/2016 11:59:45 AM (8 years ago)
Author:
johnbillion
Message:

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

Fixes #37863
Props tnash

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-comments-post.php

    r37535 r38432  
    77
    88if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
     9    $protocol = $_SERVER['SERVER_PROTOCOL'];
     10    if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
     11        $protocol = 'HTTP/1.0';
     12    }
     13
    914    header('Allow: POST');
    10     header('HTTP/1.1 405 Method Not Allowed');
     15    header("$protocol 405 Method Not Allowed");
    1116    header('Content-Type: text/plain');
    1217    exit;
Note: See TracChangeset for help on using the changeset viewer.