From eb39c8f75d7b14688223e2ef707746d8a95e8cee Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Wed, 8 Oct 2014 06:43:14 +0000 Subject: [PATCH] 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 --- src/wp-includes/class-http.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/class-http.php b/src/wp-includes/class-http.php index d52bb118fe..3aac5bae73 100644 --- a/src/wp-includes/class-http.php +++ b/src/wp-includes/class-http.php @@ -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 = (