Make WordPress Core

Changeset 29852


Ignore:
Timestamp:
10/08/2014 06:14:58 AM (12 years ago)
Author:
dd32
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-http.php

    r29851 r29852  
    971971                $strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
    972972
    973                 if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) )
     973                $include_port_in_host_header = (
     974                        ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) ||
     975                        ( 'http'  == $arrURL['scheme'] && 80  != $arrURL['port'] ) ||
     976                        ( 'https' == $arrURL['scheme'] && 443 != $arrURL['port'] )
     977                );
     978
     979                if ( $include_port_in_host_header ) {
    974980                        $strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n";
    975                 else
     981                } else {
    976982                        $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
     983                }
    977984
    978985                if ( isset($r['user-agent']) )
Note: See TracChangeset for help on using the changeset viewer.