WordPress.org

Make WordPress Core

Ticket #18685: 18685.diff

File 18685.diff, 652 bytes (added by solarissmoke, 4 years ago)

Fix REQUEST_URI when HTTP request contains an absolute URI

  • wp-includes/load.php

     
    9090        $PHP_SELF = $_SERVER['PHP_SELF']; 
    9191        if ( empty( $PHP_SELF ) ) 
    9292                $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace( '/(\?.*)?$/', '', $_SERVER["REQUEST_URI"] ); 
     93                 
     94        // Fix for HTTP/1.0 clients that include absolute URI in request 
     95        if( strpos( $_SERVER['REQUEST_URI'], $_SERVER['HTTP_HOST'] ) !== false ) 
     96                $_SERVER['REQUEST_URI'] = preg_replace( '|^https?://' . preg_quote( $_SERVER['HTTP_HOST'] ) . '|', '', $_SERVER['REQUEST_URI'] ); 
    9397} 
    9498 
    9599/**