mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 20:54:29 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@45731 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -14,6 +14,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
define( 'WPINC', 'wp-includes' );
|
||||
|
||||
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
||||
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
|
||||
$protocol = 'HTTP/1.0';
|
||||
}
|
||||
|
||||
$load = $_GET['load'];
|
||||
if ( is_array( $load ) ) {
|
||||
ksort( $load );
|
||||
@@ -24,6 +29,7 @@ $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
|
||||
$load = array_unique( explode( ',', $load ) );
|
||||
|
||||
if ( empty( $load ) ) {
|
||||
header( "$protocol 400 Bad Request" );
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -40,10 +46,6 @@ wp_default_packages_vendor( $wp_scripts );
|
||||
wp_default_packages_scripts( $wp_scripts );
|
||||
|
||||
if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
|
||||
$protocol = $_SERVER['SERVER_PROTOCOL'];
|
||||
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
|
||||
$protocol = 'HTTP/1.0';
|
||||
}
|
||||
header( "$protocol 304 Not Modified" );
|
||||
exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user