Make WordPress Core

Changeset 34123


Ignore:
Timestamp:
09/14/2015 05:36:37 PM (9 years ago)
Author:
wonderboymusic
Message:

Fix the case-sensitivity of some HTTP class usage.

See #33413.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-http.php

    r33880 r34123  
    305305         * @since 3.7.0
    306306         *
    307          * @param array  $value Array of HTTP transports to check. Default array contains
    308          *                      'curl', and 'streams', in that order.
    309          * @param array  $args  HTTP request arguments.
    310          * @param string $url   The URL to request.
     307         * @param array  $transports Array of HTTP transports to check. Default array contains
     308         *                           'curl', and 'streams', in that order.
     309         * @param array  $args       HTTP request arguments.
     310         * @param string $url        The URL to request.
    311311         */
    312         $request_order = apply_filters( 'http_api_transports', array( 'curl', 'streams' ), $args, $url );
     312        $transports = array( 'curl', 'streams' );
     313        $request_order = apply_filters( 'http_api_transports', $transports, $args, $url );
    313314
    314315        // Loop over each transport on each HTTP request looking for one which will serve this request's needs.
    315316        foreach ( $request_order as $transport ) {
    316             $class = 'WP_HTTP_' . $transport;
     317            if ( in_array( $transport, $transports ) ) {
     318                $transport = ucfirst( $transport );
     319            }
     320            $class = 'WP_Http_' . $transport;
    317321
    318322            // Check to see if this transport is a possibility, calls the transport statically.
     
    549553            foreach ( $r['cookies'] as $name => $value ) {
    550554                if ( ! is_object( $value ) )
    551                     $r['cookies'][ $name ] = new WP_HTTP_Cookie( array( 'name' => $name, 'value' => $value ) );
     555                    $r['cookies'][ $name ] = new WP_Http_Cookie( array( 'name' => $name, 'value' => $value ) );
    552556            }
    553557
     
    737741            return $maybe_relative_path;
    738742
    739         if ( ! $url_parts = WP_HTTP::parse_url( $url ) ) {
     743        if ( ! $url_parts = WP_Http::parse_url( $url ) ) {
    740744            return $maybe_relative_path;
    741745        }
    742746
    743         if ( ! $relative_url_parts = WP_HTTP::parse_url( $maybe_relative_path ) ) {
     747        if ( ! $relative_url_parts = WP_Http::parse_url( $maybe_relative_path ) ) {
    744748            return $maybe_relative_path;
    745749        }
     
    825829            $redirect_location = array_pop( $redirect_location );
    826830
    827         $redirect_location = WP_HTTP::make_absolute_url( $redirect_location, $url );
     831        $redirect_location = WP_Http::make_absolute_url( $redirect_location, $url );
    828832
    829833        // POST requests should not POST to a redirected location.
  • trunk/src/wp-includes/class-wp-http-streams.php

    r33878 r34123  
    295295
    296296        // Handle redirects.
    297         if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) )
     297        if ( false !== ( $redirect_response = WP_Http::handle_redirects( $url, $r, $response ) ) )
    298298            return $redirect_response;
    299299
     
    344344         * in the cert (if they exist)
    345345         */
    346         $host_type = ( WP_HTTP::is_ip_address( $host ) ? 'ip' : 'dns' );
     346        $host_type = ( WP_Http::is_ip_address( $host ) ? 'ip' : 'dns' );
    347347
    348348        $certificate_hostnames = array();
  • trunk/src/wp-includes/formatting.php

    r33955 r34123  
    39983998        ( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ?
    39993999            $m[3] :
    4000             WP_HTTP::make_absolute_url( $m[3], $_links_add_base )
     4000            WP_Http::make_absolute_url( $m[3], $_links_add_base )
    40014001        )
    40024002        . $m[2];
  • trunk/tests/phpunit/tests/http/base.php

    r32712 r34123  
    1717    function setUp() {
    1818
    19         if ( is_callable( array('WP_HTTP', '_getTransport') ) ) {
    20             $this->markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
     19        if ( is_callable( array('WP_Http', '_getTransport') ) ) {
     20            $this->markTestSkipped('The WP_Http tests require a class-http.php file of r17550 or later.');
    2121            return;
    2222        }
    2323
    24         $class = "WP_HTTP_" . $this->transport;
     24        $class = "WP_Http_" . $this->transport;
    2525        if ( !call_user_func( array($class, 'test') ) ) {
    2626            $this->markTestSkipped( sprintf('The transport %s is not supported on this system', $this->transport) );
     
    185185        $res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30 ) ); //Auto generate the filename.
    186186
    187         // Cleanup before we assert, as it'll return early. 
     187        // Cleanup before we assert, as it'll return early.
    188188        if ( ! is_wp_error( $res ) ) {
    189189            $filesize = filesize( $res['filename'] );
     
    206206        $res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30, 'limit_response_size' => $size ) ); //Auto generate the filename.
    207207
    208         // Cleanup before we assert, as it'll return early. 
     208        // Cleanup before we assert, as it'll return early.
    209209        if ( ! is_wp_error( $res ) ) {
    210210            $filesize = filesize( $res['filename'] );
  • trunk/tests/phpunit/tests/http/http.php

    r29864 r34123  
    1111     */
    1212    function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
    13         if ( ! is_callable( array( 'WP_HTTP', 'make_absolute_url' ) ) ) {
     13        if ( ! is_callable( array( 'WP_Http', 'make_absolute_url' ) ) ) {
    1414            $this->markTestSkipped( "This version of WP_HTTP doesn't support WP_HTTP::make_absolute_url()" );
    1515            return;
    1616        }
    1717
    18         $actual = WP_HTTP::make_absolute_url( $relative_url, $absolute_url );
     18        $actual = WP_Http::make_absolute_url( $relative_url, $absolute_url );
    1919        $this->assertEquals( $expected, $actual );
    2020    }
     
    106106
    107107/**
    108  * A Wrapper of WP_HTTP to make parse_url() publicaly accessible for testing purposes.
     108 * A Wrapper of WP_Http to make parse_url() publicaly accessible for testing purposes.
    109109 */
    110 class WP_HTTP_Testable extends WP_HTTP {
     110class WP_HTTP_Testable extends WP_Http {
    111111    public static function parse_url( $url ) {
    112112        return parent::parse_url( $url );
Note: See TracChangeset for help on using the changeset viewer.