Commit ae470d69 authored by Dries's avatar Dries

- Patch #49129 by markus: remove port from HTTP requests.

parent eaa10cd7
......@@ -314,11 +314,13 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
switch ($uri['scheme']) {
case 'http':
$port = isset($uri['port']) ? $uri['port'] : 80;
$host = $uri['host'] . ($port != 80 ? ':'. $port : '');
$fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
break;
case 'https':
// Note: Only works for PHP 4.3 compiled with OpenSSL.
$port = isset($uri['port']) ? $uri['port'] : 443;
$host = $uri['host'] . ($port != 443 ? ':'. $port : '');
$fp = @fsockopen('ssl://'. $uri['host'], $port, $errno, $errstr, 20);
break;
default:
......@@ -340,8 +342,10 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
// Create HTTP request.
$defaults = array(
// RFC 2616: "non-standard ports MUST, default ports MAY be included". We always add it.
'Host' => "Host: $uri[host]:$port",
// RFC 2616: "non-standard ports MUST, default ports MAY be included".
// We don't add the port to prevent from breaking rewrite rules checking
// the host that do not take into account the port number.
'Host' => "Host: $host",
'User-Agent' => 'User-Agent: Drupal (+http://www.drupal.org/)',
'Content-Length' => 'Content-Length: '. strlen($data)
);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment