Make WordPress Core

Changeset 52087


Ignore:
Timestamp:
11/09/2021 11:04:59 PM (3 months ago)
Author:
davidbaumwald
Message:

Bootstrap/Load: Add HTTP/3 as a valid HTTP protocol.

As of November 2021, the HTTP/3 protocol is still officially an Internet Draft, but is already supported by 74% of running web browsers and, according to W3Techs, 23% of the top 10 million websites. It has been supported by Google Chrome (including Chrome for Android, and Microsoft Edge, which is based on it) since April 2020 and by Mozilla Firefox since May 2021. Safari 14 (on macOS Big Sur and iOS 14) has also implemented the protocol but support is hidden behind a feature flag.

Based on the wide support, this change adds HTTP/3 as a valid HTTP protocol.

Props malthert.
Fixes #54404.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/load-scripts.php

    r47855 r52087  
    1616
    1717$protocol = $_SERVER['SERVER_PROTOCOL'];
    18 if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
     18if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
    1919    $protocol = 'HTTP/1.0';
    2020}
  • trunk/src/wp-admin/load-styles.php

    r52054 r52087  
    2424
    2525$protocol = $_SERVER['SERVER_PROTOCOL'];
    26 if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
     26if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
    2727    $protocol = 'HTTP/1.0';
    2828}
  • trunk/src/wp-comments-post.php

    r50375 r52087  
    88if ( 'POST' !== $_SERVER['REQUEST_METHOD'] ) {
    99    $protocol = $_SERVER['SERVER_PROTOCOL'];
    10     if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
     10    if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
    1111        $protocol = 'HTTP/1.0';
    1212    }
  • trunk/src/wp-includes/load.php

    r51358 r52087  
    1515function wp_get_server_protocol() {
    1616    $protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : '';
    17     if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ), true ) ) {
     17    if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
    1818        $protocol = 'HTTP/1.0';
    1919    }
Note: See TracChangeset for help on using the changeset viewer.