Make WordPress Core


Ignore:
Timestamp:
08/03/2019 10:16:23 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Script Loader: Send a 400 Bad Request status code in load-scripts.php and load-styles.php if the required load[] parameter is not set.

Props compilenix.
Fixes #44108.

File:
1 edited

Legend:

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

    r45456 r45731  
    1919require( ABSPATH . WPINC . '/version.php' );
    2020
     21$protocol = $_SERVER['SERVER_PROTOCOL'];
     22if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
     23    $protocol = 'HTTP/1.0';
     24}
     25
    2126$load = $_GET['load'];
    2227if ( is_array( $load ) ) {
     
    2934
    3035if ( empty( $load ) ) {
     36    header( "$protocol 400 Bad Request" );
    3137    exit;
    3238}
     
    4046
    4147if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
    42     $protocol = $_SERVER['SERVER_PROTOCOL'];
    43     if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
    44         $protocol = 'HTTP/1.0';
    45     }
    4648    header( "$protocol 304 Not Modified" );
    4749    exit();
Note: See TracChangeset for help on using the changeset viewer.