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


git-svn-id: https://develop.svn.wordpress.org/trunk@29853 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2014-10-08 06:43:14 +00:00
parent 45cd55bfc4
commit eb39c8f75d

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 = (