Ticket #37733: 37733.diff
File 37733.diff, 1.4 KB (added by , 8 years ago) |
---|
-
src/wp-includes/class-http.php
272 272 return new WP_Error( 'http_request_failed', __( 'User has blocked requests through HTTP.' ) ); 273 273 } 274 274 275 // Fix URLs with double slashes at the start of the path. 276 if ( ! empty( $arrURL['path'] ) && 0 === strpos( $arrURL['path'], '//' ) ) { 277 $new_path = substr( $arrURL['path'], 1 ); 278 $url = str_replace( $arrURL['path'], $new_path, $url ); 279 $arrURL['path'] = $new_path; 280 } 281 275 282 // If we are streaming to a file but no filename was given drop it in the WP temp dir 276 283 // and pick its name using the basename of the $url 277 284 if ( $r['stream'] ) { -
tests/phpunit/tests/http/base.php
376 376 $this->assertTrue( ! is_wp_error( $res ), print_r( $res, true ) ); 377 377 } 378 378 379 /** 380 * @ticket 37733 381 */ 382 function test_url_with_double_slashes_path() { 383 $url = $this->redirection_script . '?rt=' . 0; 379 384 385 $path = parse_url( $url, PHP_URL_PATH ); 386 $url = str_replace( $path, '/' . $path, $url ); 387 388 $res = wp_remote_request( $url ); 389 $this->assertNotWPError( $res ); 390 } 391 392 380 393 }