Skip to content

Commit

Permalink
Merge pull request #238 from dd32/host-port-differs-default
Browse files Browse the repository at this point in the history
Only include the port number in the `Host` header when it differs from default
  • Loading branch information
rmccue authored Sep 16, 2016
2 parents ea11b38 + 9b402cb commit c347853
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/Requests/Transport/fsockopen.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function request($url, $headers = array(), $data = array(), $options = ar
if (!isset($case_insensitive_headers['Host'])) {
$out .= sprintf('Host: %s', $url_parts['host']);

if ($url_parts['port'] !== 80) {
if (( 'http' === strtolower($url_parts['scheme']) && $url_parts['port'] !== 80 ) || ( 'https' === strtolower($url_parts['scheme']) && $url_parts['port'] !== 443 )) {
$out .= ':' . $url_parts['port'];
}
$out .= "\r\n";
Expand Down

0 comments on commit c347853

Please sign in to comment.