summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2008-09-06 15:06:10 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2008-09-06 15:06:10 +0000
commit73356fde8b3ebd076e2c588bb8935f914fd8ebb8 (patch)
treef417468dde71b29eecc2763a5c60eceab13685ae
parente5b0e5f76c0695a01d13c55147a8287df8750594 (diff)
downloadbrdo-73356fde8b3ebd076e2c588bb8935f914fd8ebb8.tar.gz
brdo-73356fde8b3ebd076e2c588bb8935f914fd8ebb8.tar.bz2
#296310 by DamZ: Fixes to drupal_http_request() and accompanying tests.
-rw-r--r--includes/common.inc4
-rw-r--r--modules/simpletest/tests/common.test6
2 files changed, 5 insertions, 5 deletions
diff --git a/includes/common.inc b/includes/common.inc
index be43d6638..13628d2f1 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -563,8 +563,8 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
$location = $result->headers['Location'];
if ($retry) {
- $result = drupal_http_request($result->headers['Location'], $headers, $method, $data, --$retry);
- $result->redirect_code = $result->code;
+ $result = drupal_http_request($location, $headers, $method, $data, --$retry);
+ $result->redirect_code = $code;
}
$result->redirect_url = $location;
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 25c15ab1e..176cc3502 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -168,7 +168,7 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
function testDrupalHTTPRequestRedirect() {
$redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array(), 'GET', NULL, 1);
- $this->assertEqual($redirect_301->redirect_code, 200, t('drupal_http_request follows the 301 redirect.'));
+ $this->assertEqual($redirect_301->redirect_code, 301, t('drupal_http_request follows the 301 redirect.'));
$redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array(), 'GET', NULL, 0);
$this->assertFalse(isset($redirect_301->redirect_code), t('drupal_http_request does not follow 301 redirect if $retry = 0.'));
@@ -183,13 +183,13 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
$this->assertEqual($redirect_invalid->error, 'invalid schema ftp', t('301 redirect to invalid URL returned with error "!error".', array('!error' => $redirect_invalid->error)));
$redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array(), 'GET', NULL, 1);
- $this->assertEqual($redirect_302->redirect_code, 200, t('drupal_http_request follows the 302 redirect.'));
+ $this->assertEqual($redirect_302->redirect_code, 302, t('drupal_http_request follows the 302 redirect.'));
$redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array(), 'GET', NULL, 0);
$this->assertFalse(isset($redirect_302->redirect_code), t('drupal_http_request does not follow 302 redirect if $retry = 0.'));
$redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array(), 'GET', NULL, 1);
- $this->assertEqual($redirect_307->redirect_code, 200, t('drupal_http_request follows the 307 redirect.'));
+ $this->assertEqual($redirect_307->redirect_code, 307, t('drupal_http_request follows the 307 redirect.'));
$redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array(), 'GET', NULL, 0);
$this->assertFalse(isset($redirect_307->redirect_code), t('drupal_http_request does not follow 307 redirect if $retry = 0.'));