Title: wp-comments-post.php HTTP version
Last modified: September 1, 2016

---

# wp-comments-post.php HTTP version

 *  Resolved [kobashicomputing](https://wordpress.org/support/users/kobashicomputing/)
 * (@kobashicomputing)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/wp-comments-postphp-http-version/)
 * This needs to be changed from the hard coded HTTP 1.1 header to support HTTP 
   2 support:
 *     ```
       if ('POST' != $_SERVER['REQUEST_METHOD']) {
         header('Allow: POST');
         header('HTTP/1.1 405 Method Not Allowed');
         header('Content-Type: text/plain');
         exit;
       }
       ```
   
 * To:
 *     ```
       if ('POST' != $_SERVER['REQUEST_METHOD']) {
         header('Allow: POST');
         header($_SERVER['SERVER_PROTOCOL'] . ' 405 Method Not Allowed');
         header('Content-Type: text/plain');
         exit;
       }
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/wp-comments-postphp-http-version/#post-7709054)
 * Would you please file that as a bug report with patch following the instructions
   at [https://make.wordpress.org/core/handbook/testing/reporting-bugs/](https://make.wordpress.org/core/handbook/testing/reporting-bugs/)?
 * That way, you’ll get credit on the next release when it’s accepted, even if it
   just inspires a different change. 🙂
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [9 years, 9 months ago](https://wordpress.org/support/topic/wp-comments-postphp-http-version/#post-7709080)
 * You can submit a trac ticket but that’s not correct.
 * Switching to `https` and getting `HTTP/1.1 405 Method Not Allowed` is still valid.
   The application status code doesn’t become `HTTPS/1.1 405 Method Not Allowed`
   when you are using an encrypted transport.
 * For example using curl to view the headers `https://www.google.com/` will get
   you an HTTP/1.1 result code.
 *     ```
       $ curl -I https://www.google.com/
       HTTP/1.1 200 OK
       ```
   
 * After the TLS setup and exchange, the application protocol is still HTTP/1.1.
   I haven’t checked with HTTP/2 but I’m pretty sure the result code will be similar.
 * **Edit:** Right, and that’s why I need coffee. HTTP/2 is what you are talking
   about _as you clearly stated_.
 * My bad. I focused on `$_SERVER['SERVER_PROTOCOL'` when you are clearly talking
   about hardcoding 1.1 as the protocol version number when it should detect it 
   correctly in preparation of HTTP/2.
 *  Thread Starter [kobashicomputing](https://wordpress.org/support/users/kobashicomputing/)
 * (@kobashicomputing)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/wp-comments-postphp-http-version/#post-7709191)
 * Someone beat me to the ticket after obviously having read this very thread.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [9 years, 9 months ago](https://wordpress.org/support/topic/wp-comments-postphp-http-version/#post-7709192)
 * What’s the trac ticket URL? You can always improve on the code and suggest better
   protocol version checks to validate HTTP/1.1 and HTTP/2.0.
 *  Thread Starter [kobashicomputing](https://wordpress.org/support/users/kobashicomputing/)
 * (@kobashicomputing)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/wp-comments-postphp-http-version/#post-7709194)
 * This has nothing to do with validating. It is what WordPress is **sending back**
   to the client in response to an improper HTTP METHOD request other than “POST”.
 * The only piece of information that WordPress has available to it on HTTP server
   protocol is through:
 * `$_SERVER['SERVER_PROTOCOL']`
 * It must not fake the client out thinking it is something other than what the 
   HTTP server is reporting.
 * [#37863](https://core.trac.wordpress.org/ticket/37863) got re-opened.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘wp-comments-post.php HTTP version’ is closed to new replies.

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 5 replies
 * 3 participants
 * Last reply from: [kobashicomputing](https://wordpress.org/support/users/kobashicomputing/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/wp-comments-postphp-http-version/#post-7709194)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
