Fix the case-sensitivity of some HTTP class usage.
See #33413. git-svn-id: https://develop.svn.wordpress.org/trunk@34123 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
811e538325
commit
2c91a4d1e0
|
@ -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'] ) {
|
||||
|
|
|
@ -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'] ) ) {
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
|
|||
|
||||
function setUp() {
|
||||
|
||||
if ( is_callable( array('WP_HTTP', '_getTransport') ) ) {
|
||||
$this->markTestSkipped('The WP_HTTP tests require a class-http.php file of r17550 or later.');
|
||||
if ( is_callable( array('WP_Http', '_getTransport') ) ) {
|
||||
$this->markTestSkipped('The WP_Http tests require a class-http.php file of r17550 or later.');
|
||||
return;
|
||||
}
|
||||
|
||||
$class = "WP_HTTP_" . $this->transport;
|
||||
$class = "WP_Http_" . $this->transport;
|
||||
if ( !call_user_func( array($class, 'test') ) ) {
|
||||
$this->markTestSkipped( sprintf('The transport %s is not supported on this system', $this->transport) );
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
|
|||
$size = 87348;
|
||||
$res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30 ) ); //Auto generate the filename.
|
||||
|
||||
// Cleanup before we assert, as it'll return early.
|
||||
// Cleanup before we assert, as it'll return early.
|
||||
if ( ! is_wp_error( $res ) ) {
|
||||
$filesize = filesize( $res['filename'] );
|
||||
unlink( $res['filename'] );
|
||||
|
@ -205,7 +205,7 @@ abstract class WP_HTTP_UnitTestCase extends WP_UnitTestCase {
|
|||
$size = 10000;
|
||||
$res = wp_remote_request( $url, array( 'stream' => true, 'timeout' => 30, 'limit_response_size' => $size ) ); //Auto generate the filename.
|
||||
|
||||
// Cleanup before we assert, as it'll return early.
|
||||
// Cleanup before we assert, as it'll return early.
|
||||
if ( ! is_wp_error( $res ) ) {
|
||||
$filesize = filesize( $res['filename'] );
|
||||
unlink( $res['filename'] );
|
||||
|
|
|
@ -10,12 +10,12 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
|
|||
* @dataProvider make_absolute_url_testcases
|
||||
*/
|
||||
function test_make_absolute_url( $relative_url, $absolute_url, $expected ) {
|
||||
if ( ! is_callable( array( 'WP_HTTP', 'make_absolute_url' ) ) ) {
|
||||
if ( ! is_callable( array( 'WP_Http', 'make_absolute_url' ) ) ) {
|
||||
$this->markTestSkipped( "This version of WP_HTTP doesn't support WP_HTTP::make_absolute_url()" );
|
||||
return;
|
||||
}
|
||||
|
||||
$actual = WP_HTTP::make_absolute_url( $relative_url, $absolute_url );
|
||||
$actual = WP_Http::make_absolute_url( $relative_url, $absolute_url );
|
||||
$this->assertEquals( $expected, $actual );
|
||||
}
|
||||
|
||||
|
@ -105,9 +105,9 @@ class Tests_HTTP_HTTP extends WP_UnitTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* A Wrapper of WP_HTTP to make parse_url() publicaly accessible for testing purposes.
|
||||
* A Wrapper of WP_Http to make parse_url() publicaly accessible for testing purposes.
|
||||
*/
|
||||
class WP_HTTP_Testable extends WP_HTTP {
|
||||
class WP_HTTP_Testable extends WP_Http {
|
||||
public static function parse_url( $url ) {
|
||||
return parent::parse_url( $url );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue