From 3a0db2a22fced57184db57327943788aae538f78 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Mon, 14 Sep 2015 17:37:25 +0000 Subject: [PATCH] Fix the case-sensitivity of some HTTP class usage. See #33413. Built from https://develop.svn.wordpress.org/trunk@34123 git-svn-id: http://core.svn.wordpress.org/trunk@34091 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-http.php | 24 ++++++++++++++---------- wp-includes/class-wp-http-streams.php | 4 ++-- wp-includes/formatting.php | 2 +- wp-includes/version.php | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/wp-includes/class-http.php b/wp-includes/class-http.php index b70c8571bf..8422ca34af 100644 --- a/wp-includes/class-http.php +++ b/wp-includes/class-http.php @@ -304,16 +304,20 @@ class WP_Http { * * @since 3.7.0 * - * @param array $value Array of HTTP transports to check. Default array contains - * 'curl', and 'streams', in that order. - * @param array $args HTTP request arguments. - * @param string $url The URL to request. + * @param array $transports Array of HTTP transports to check. Default array contains + * 'curl', and 'streams', in that order. + * @param array $args HTTP request arguments. + * @param string $url The URL to request. */ - $request_order = apply_filters( 'http_api_transports', array( 'curl', 'streams' ), $args, $url ); + $transports = array( 'curl', 'streams' ); + $request_order = apply_filters( 'http_api_transports', $transports, $args, $url ); // Loop over each transport on each HTTP request looking for one which will serve this request's needs. foreach ( $request_order as $transport ) { - $class = 'WP_HTTP_' . $transport; + if ( in_array( $transport, $transports ) ) { + $transport = ucfirst( $transport ); + } + $class = 'WP_Http_' . $transport; // Check to see if this transport is a possibility, calls the transport statically. if ( !call_user_func( array( $class, 'test' ), $args, $url ) ) @@ -548,7 +552,7 @@ class WP_Http { // Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances. foreach ( $r['cookies'] as $name => $value ) { if ( ! is_object( $value ) ) - $r['cookies'][ $name ] = new WP_HTTP_Cookie( array( 'name' => $name, 'value' => $value ) ); + $r['cookies'][ $name ] = new WP_Http_Cookie( array( 'name' => $name, 'value' => $value ) ); } $cookies_header = ''; @@ -736,11 +740,11 @@ class WP_Http { if ( empty( $url ) ) return $maybe_relative_path; - if ( ! $url_parts = WP_HTTP::parse_url( $url ) ) { + if ( ! $url_parts = WP_Http::parse_url( $url ) ) { return $maybe_relative_path; } - if ( ! $relative_url_parts = WP_HTTP::parse_url( $maybe_relative_path ) ) { + if ( ! $relative_url_parts = WP_Http::parse_url( $maybe_relative_path ) ) { return $maybe_relative_path; } @@ -824,7 +828,7 @@ class WP_Http { if ( is_array( $redirect_location ) ) $redirect_location = array_pop( $redirect_location ); - $redirect_location = WP_HTTP::make_absolute_url( $redirect_location, $url ); + $redirect_location = WP_Http::make_absolute_url( $redirect_location, $url ); // POST requests should not POST to a redirected location. if ( 'POST' == $args['method'] ) { diff --git a/wp-includes/class-wp-http-streams.php b/wp-includes/class-wp-http-streams.php index 1bef590f4e..8c12fce81c 100644 --- a/wp-includes/class-wp-http-streams.php +++ b/wp-includes/class-wp-http-streams.php @@ -294,7 +294,7 @@ class WP_Http_Streams { ); // Handle redirects. - if ( false !== ( $redirect_response = WP_HTTP::handle_redirects( $url, $r, $response ) ) ) + if ( false !== ( $redirect_response = WP_Http::handle_redirects( $url, $r, $response ) ) ) return $redirect_response; // If the body was chunk encoded, then decode it. @@ -343,7 +343,7 @@ class WP_Http_Streams { * If the request is being made to an IP address, we'll validate against IP fields * in the cert (if they exist) */ - $host_type = ( WP_HTTP::is_ip_address( $host ) ? 'ip' : 'dns' ); + $host_type = ( WP_Http::is_ip_address( $host ) ? 'ip' : 'dns' ); $certificate_hostnames = array(); if ( ! empty( $cert['extensions']['subjectAltName'] ) ) { diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index a84391f19e..7ca00c5cbb 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3997,7 +3997,7 @@ function _links_add_base( $m ) { return $m[1] . '=' . $m[2] . ( preg_match( '#^(\w{1,20}):#', $m[3], $protocol ) && in_array( $protocol[1], wp_allowed_protocols() ) ? $m[3] : - WP_HTTP::make_absolute_url( $m[3], $_links_add_base ) + WP_Http::make_absolute_url( $m[3], $_links_add_base ) ) . $m[2]; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 6fc0f34bb2..f96e796269 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34122'; +$wp_version = '4.4-alpha-34123'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.