summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-02-16 13:00:18 +0000
committerDries Buytaert <dries@buytaert.net>2006-02-16 13:00:18 +0000
commitae470d6943c39a6cdc81ee782fc296bce8a41dbe (patch)
tree8a93db977ac56e02b3100a99fa54217320253e2b /includes
parenteaa10cd724e42c873d9c1def9a0e3e0a34e06428 (diff)
downloadbrdo-ae470d6943c39a6cdc81ee782fc296bce8a41dbe.tar.gz
brdo-ae470d6943c39a6cdc81ee782fc296bce8a41dbe.tar.bz2
- Patch #49129 by markus: remove port from HTTP requests.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc8
1 files changed, 6 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 52088a12f..567d93262 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -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)
);