From 49f820a120ed75de293e6f8237b6b237af211d3b Mon Sep 17 00:00:00 2001
From: Heine <heine@17943.no-reply.drupal.org>
Date: Sun, 6 Mar 2011 22:02:05 -0800
Subject: [PATCH] Issue #1081068 by Heine: Fixed drupal_http_request() inconsistent redirect_url().

---
 includes/common.inc |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/includes/common.inc b/includes/common.inc
index a6901f3..f15bcfc 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -752,7 +752,8 @@ function drupal_access_denied() {
  *     received.
  *   - redirect_code: If redirected, an integer containing the initial response
  *     status code.
- *   - redirect_url: If redirected, a string containing the redirection location.
+ *   - redirect_url: If redirected, a string containing the final redirection
+ *     location.
  *   - error: If an error occurred, the error message. Otherwise not set.
  *   - headers: An array containing the response headers as name/value pairs.
  *     HTTP header names are case-insensitive (RFC 2616, section 4.2), so for
@@ -1006,7 +1007,7 @@ function drupal_http_request($url, array $options = array()) {
         $result = drupal_http_request($location, $options);
         $result->redirect_code = $code;
       }
-      $result->redirect_url = $location;
+      $result->redirect_url = isset($result->redirect_url) ? $result->redirect_url : $location;
       break;
     default:
       $result->error = $status_message;
-- 
1.7.3.5

