summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-05-08 22:19:04 +0000
committerDries Buytaert <dries@buytaert.net>2009-05-08 22:19:04 +0000
commitada73058d3ad5235af3c2b272a60432afcefd535 (patch)
treefca68a714daa3c181fe209b269e86d09ca996e35
parentf116acc887cb90d1b1ff6d0a4fdf255689b03a3b (diff)
downloadbrdo-ada73058d3ad5235af3c2b272a60432afcefd535.tar.gz
brdo-ada73058d3ad5235af3c2b272a60432afcefd535.tar.bz2
- Patch #457788 by c960657: drupal_http_request() does not handle redirects properly.
-rw-r--r--includes/common.inc17
1 files changed, 8 insertions, 9 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 72b68a631..76637a4c7 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -521,14 +521,15 @@ function drupal_http_request($url, array $options = array()) {
// Merge the default headers.
$options['headers'] += array(
- // 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,
'User-Agent' => 'Drupal (+http://drupal.org/)',
'Content-Length' => strlen($options['data']),
);
+ // RFC 2616: "non-standard ports MUST, default ports MAY be included".
+ // We don't add the standard port to prevent from breaking rewrite rules
+ // checking the host that do not take into account the port number.
+ $options['headers']['Host'] = $host;
+
// If the server url has a user then attempt to use basic authentication
if (isset($uri['user'])) {
$options['headers']['Authorization'] = 'Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));
@@ -544,13 +545,11 @@ function drupal_http_request($url, array $options = array()) {
$options['headers']['User-Agent'] = $matches[0];
}
+ $request = $options['method'] . ' ' . $path . " HTTP/1.0\r\n";
foreach ($options['headers'] as $name => $value) {
- $options['headers'][$name] = $name . ': ' . trim($value);
+ $request .= $name . ': ' . trim($value) . "\r\n";
}
-
- $request = $options['method'] . ' ' . $path . " HTTP/1.0\r\n";
- $request .= implode("\r\n", $options['headers']);
- $request .= "\r\n\r\n" . $options['data'];
+ $request .= "\r\n" . $options['data'];
$result->request = $request;
fwrite($fp, $request);