Avoid a PHP Notice when requesting a url without a path component (http://example.com) in the Streams HTTP component.

Props barrykooij for inital patch; Fixes #27668

Built from https://develop.svn.wordpress.org/trunk@29853


git-svn-id: http://core.svn.wordpress.org/trunk@29616 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2014-10-08 06:44:19 +00:00
parent f09c515ad9
commit 98ff88518a

View File

@ -861,6 +861,11 @@ class WP_Http_Streams {
}
}
// Always pass a Path, defaulting to the root in cases such as http://example.com
if ( ! isset( $arrURL['path'] ) ) {
$arrURL['path'] = '/';
}
if ( isset( $r['headers']['Host'] ) || isset( $r['headers']['host'] ) ) {
if ( isset( $r['headers']['Host'] ) )
$arrURL['host'] = $r['headers']['Host'];
@ -965,9 +970,6 @@ class WP_Http_Streams {
else
$requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' );
if ( empty($requestPath) )
$requestPath .= '/';
$strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
$include_port_in_host_header = (