[wp-trac] [WordPress Trac] #37863: HTTP/1.1 defined header in wp-comments-post.php

WordPress Trac noreply at wordpress.org
Mon Aug 29 07:17:03 UTC 2016


#37863: HTTP/1.1 defined header in wp-comments-post.php
--------------------------+-----------------------------
 Reporter:  tnash         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  4.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 {{{
 if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
         header('Allow: POST');
         header('HTTP/1.1 405 Method Not Allowed');
         header('Content-Type: text/plain');
         exit;
 }
 }}}
 Should ideally be protocol agnostic, to support HTTP/2 in line with other
 files this should probably be
 {{{
 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("$protocol 405 Method Not Allowed");
         header('Content-Type: text/plain');
         exit;
 }
 }}}
 in line with other files, which can't use wp_get_server_protocol(); prior
 to wp_load.php

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37863>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list