Ticket #34131: 34131.2.diff
File 34131.2.diff, 2.7 KB (added by , 9 years ago) |
---|
-
src/wp-includes/functions.php
992 992 if ( empty( $description ) ) 993 993 return; 994 994 995 $protocol = $_SERVER['SERVER_PROTOCOL']; 996 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) 997 $protocol = 'HTTP/1.0'; 995 $protocol = wp_get_server_protocol(); 998 996 $status_header = "$protocol $code $description"; 999 997 if ( function_exists( 'apply_filters' ) ) 1000 998 -
src/wp-includes/load.php
8 8 */ 9 9 10 10 /** 11 * Return the HTTP protocol sent by the server. 12 * 13 * @since 4.4.0 14 * 15 * @return string The HTTP protocol. Default: HTTP/1.0. 16 */ 17 function wp_get_server_protocol() { 18 $protocol = $_SERVER['SERVER_PROTOCOL']; 19 if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) { 20 $protocol = 'HTTP/1.0'; 21 } 22 return $protocol; 23 } 24 25 /** 11 26 * Turn register globals off. 12 27 * 13 28 * @since 2.1.0 … … 112 127 if ( version_compare( $required_php_version, $php_version, '>' ) ) { 113 128 wp_load_translations_early(); 114 129 115 $protocol = $_SERVER['SERVER_PROTOCOL']; 116 if ( 'HTTP/1.1' !== $protocol && 'HTTP/1.0' !== $protocol ) { 117 $protocol = 'HTTP/1.0'; 118 } 130 $protocol = wp_get_server_protocol(); 119 131 header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); 120 132 header( 'Content-Type: text/html; charset=utf-8' ); 121 133 die( sprintf( __( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.' ), $php_version, $wp_version, $required_php_version ) ); … … 124 136 if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' ) ) { 125 137 wp_load_translations_early(); 126 138 127 $protocol = $_SERVER['SERVER_PROTOCOL']; 128 if ( 'HTTP/1.1' !== $protocol && 'HTTP/1.0' !== $protocol ) { 129 $protocol = 'HTTP/1.0'; 130 } 139 $protocol = wp_get_server_protocol(); 131 140 header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 ); 132 141 header( 'Content-Type: text/html; charset=utf-8' ); 133 142 die( __( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ) ); … … 182 191 183 192 wp_load_translations_early(); 184 193 185 $protocol = $_SERVER["SERVER_PROTOCOL"]; 186 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) 187 $protocol = 'HTTP/1.0'; 194 $protocol = wp_get_server_protocol(); 188 195 header( "$protocol 503 Service Unavailable", true, 503 ); 189 196 header( 'Content-Type: text/html; charset=utf-8' ); 190 197 header( 'Retry-After: 600' );