HTTP: Handle an edgecase within the URI parsing library included in Requests, where if a double slash exists at the start of the path the URL is passed to cURL malformed.

Props flixos90 for initial patch.
Fixes #37733 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@38429 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2016-08-29 02:32:48 +00:00
parent 3b723b31ee
commit 7f2a81061a
2 changed files with 16 additions and 0 deletions

View File

@@ -362,6 +362,9 @@ class WP_Http {
}
}
// Work around a bug in Requests when the path starts with // See https://github.com/rmccue/Requests/issues/231
$url = preg_replace( '!^(\w+://[^/]+)//(.*)$!i', '$1/$2', $url );
try {
$requests_response = Requests::request( $url, $headers, $data, $type, $options );