Ticket #33978: 33978.patch
File 33978.patch, 2.9 KB (added by , 10 years ago) |
---|
-
src/wp-includes/class-wp-http-curl.php
133 133 curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true ); 134 134 curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false ); 135 135 curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify ); 136 curl_setopt( $handle, CURLOPT_CAINFO, $r['sslcertificates'] ); 136 137 if ( $ssl_verify ) { 138 curl_setopt( $handle, CURLOPT_CAINFO, $r['sslcertificates'] ); 139 } 140 137 141 curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] ); 138 142 139 143 /* -
tests/phpunit/tests/http/base.php
14 14 // You can use your own version of data/WPHTTP-testcase-redirection-script.php here. 15 15 var $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php'; 16 16 17 protected $http_request_args; 18 17 19 function setUp() { 18 20 19 21 if ( is_callable( array('WP_Http', '_getTransport') ) ) { … … 41 43 parent::tearDown(); 42 44 } 43 45 46 function filter_http_request_args( array $args ) { 47 $this->http_request_args = $args; 48 return $args; 49 } 50 44 51 function test_redirect_on_301() { 45 52 // 5 : 5 & 301 46 53 $res = wp_remote_request($this->redirection_script . '?code=301&rt=' . 5, array('redirection' => 5) ); … … 283 290 } 284 291 285 292 /** 293 * Test HTTP requests where SSL verification is disabled but the CA bundle is still populated 294 * 295 * @ticket 33978 296 */ 297 function test_https_url_without_ssl_verification() { 298 $url = 'https://wordpress.org/'; 299 $args = array( 300 'sslverify' => false, 301 ); 302 303 add_filter( 'http_request_args', array( $this, 'filter_http_request_args' ) ); 304 305 $res = wp_remote_head( $url, $args ); 306 307 remove_filter( 'http_request_args', array( $this, 'filter_http_request_args' ) ); 308 309 $this->assertNotEmpty( $this->http_request_args['sslcertificates'] ); 310 $this->assertNotWPError( $res ); 311 } 312 313 /** 286 314 * Test HTTP Redirects with multiple Location headers specified 287 315 * 288 316 * @ticket 16890 -
tests/phpunit/includes/testcase.php
301 301 $this->assertInstanceOf( 'WP_Error', $actual, $message ); 302 302 } 303 303 304 function assertNotWPError( $actual, $message = '' ) { 305 if ( is_wp_error( $actual ) && '' === $message ) { 306 $message = $actual->get_error_message(); 307 } 308 $this->assertNotInstanceOf( 'WP_Error', $actual, $message ); 309 } 310 304 311 function assertEqualFields( $object, $fields ) { 305 312 foreach( $fields as $field_name => $field_value ) { 306 313 if ( $object->$field_name != $field_value ) {