When making a HTTP request to a non-standard port, include the port in the Host header for the Streams HTTP transport. This bring parity to the cURL transport and respects the HTTP RFC.
Props kamelkev for the initial patch; Fixes #28982 Built from https://develop.svn.wordpress.org/trunk@29852 git-svn-id: http://core.svn.wordpress.org/trunk@29615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
78f4cd2c58
commit
f09c515ad9
|
@ -970,10 +970,17 @@ class WP_Http_Streams {
|
|||
|
||||
$strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
|
||||
|
||||
if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
|
||||
$include_port_in_host_header = (
|
||||
( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) ||
|
||||
( 'http' == $arrURL['scheme'] && 80 != $arrURL['port'] ) ||
|
||||
( 'https' == $arrURL['scheme'] && 443 != $arrURL['port'] )
|
||||
);
|
||||
|
||||
if ( $include_port_in_host_header ) {
|
||||
$strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n";
|
||||
else
|
||||
} else {
|
||||
$strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
|
||||
}
|
||||
|
||||
if ( isset($r['user-agent']) )
|
||||
$strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
|
||||
|
|
Loading…
Reference in New Issue