diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/aggregator/aggregator.fetcher.inc | 3 | ||||
-rw-r--r-- | modules/openid/openid.module | 20 | ||||
-rw-r--r-- | modules/simpletest/tests/common.test | 22 |
3 files changed, 27 insertions, 18 deletions
diff --git a/modules/aggregator/aggregator.fetcher.inc b/modules/aggregator/aggregator.fetcher.inc index 13baadba1..ac91a0dc1 100644 --- a/modules/aggregator/aggregator.fetcher.inc +++ b/modules/aggregator/aggregator.fetcher.inc @@ -32,7 +32,8 @@ function aggregator_aggregator_fetch($feed) { } // Request feed. - $result = drupal_http_request($feed->url, $headers); + $result = drupal_http_request($feed->url, array('headers' => $headers)); + // Process HTTP response code. switch ($result->code) { diff --git a/modules/openid/openid.module b/modules/openid/openid.module index affe9787e..d024105f4 100644 --- a/modules/openid/openid.module +++ b/modules/openid/openid.module @@ -272,7 +272,7 @@ function openid_discovery($claimed_id) { if ($url['scheme'] == 'http' || $url['scheme'] == 'https') { // For regular URLs, try Yadis resolution first, then HTML-based discovery $headers = array('Accept' => 'application/xrds+xml'); - $result = drupal_http_request($xrds_url, $headers); + $result = drupal_http_request($xrds_url, array('headers' => $headers)); if (!isset($result->error)) { if (isset($result->headers['Content-Type']) && preg_match("/application\/xrds\+xml/", $result->headers['Content-Type'])) { @@ -290,7 +290,7 @@ function openid_discovery($claimed_id) { } if (!empty($xrds_url)) { $headers = array('Accept' => 'application/xrds+xml'); - $xrds_result = drupal_http_request($xrds_url, $headers); + $xrds_result = drupal_http_request($xrds_url, array('headers' => $headers)); if (!isset($xrds_result->error)) { $services = xrds_parse($xrds_result->data); } @@ -347,8 +347,12 @@ function openid_association($op_endpoint) { // If there is no existing association, then request one $assoc_request = openid_association_request($public); $assoc_message = _openid_encode_message(_openid_create_message($assoc_request)); - $assoc_headers = array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8'); - $assoc_result = drupal_http_request($op_endpoint, $assoc_headers, 'POST', $assoc_message); + $assoc_options = array( + 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8'), + 'method' => 'POST', + 'data' => $assoc_message, + ); + $assoc_result = drupal_http_request($op_endpoint, $assoc_options); if (isset($assoc_result->error)) { module_invoke('system', 'check_http_request'); return FALSE; @@ -509,8 +513,12 @@ function openid_verify_assertion($op_endpoint, $response) { $request = $response; $request['openid.mode'] = 'check_authentication'; $message = _openid_create_message($request); - $headers = array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8'); - $result = drupal_http_request($op_endpoint, $headers, 'POST', _openid_encode_message($message)); + $options = array( + 'headers' => array('Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8'), + 'method' => 'POST', + 'data' => _openid_encode_message($message), + ); + $result = drupal_http_request($op_endpoint, $options); if (!isset($result->error)) { $response = _openid_parse_message($result->data); if (strtolower(trim($response['is_valid'])) == 'true') { diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test index b10b0be05..ca4a0459a 100644 --- a/modules/simpletest/tests/common.test +++ b/modules/simpletest/tests/common.test @@ -244,32 +244,32 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase { } function testDrupalHTTPRequestRedirect() { - $redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array(), 'GET', NULL, 1); + $redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 1)); $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.')); + $redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 0)); + $this->assertFalse(isset($redirect_301->redirect_code), t('drupal_http_request does not follow 301 redirect if max_redirects = 0.')); - $redirect_invalid = drupal_http_request(url('system-test/redirect-noscheme', array('absolute' => TRUE)), array(), 'GET', NULL, 1); + $redirect_invalid = drupal_http_request(url('system-test/redirect-noscheme', array('absolute' => TRUE)), array('max_redirects' => 1)); $this->assertEqual($redirect_invalid->error, 'missing schema', t('301 redirect to invalid URL returned with error "!error".', array('!error' => $redirect_invalid->error))); - $redirect_invalid = drupal_http_request(url('system-test/redirect-noparse', array('absolute' => TRUE)), array(), 'GET', NULL, 1); + $redirect_invalid = drupal_http_request(url('system-test/redirect-noparse', array('absolute' => TRUE)), array('max_redirects' => 1)); $this->assertEqual($redirect_invalid->error, 'unable to parse URL', t('301 redirect to invalid URL returned with error "!error".', array('!error' => $redirect_invalid->error))); - $redirect_invalid = drupal_http_request(url('system-test/redirect-invalid-scheme', array('absolute' => TRUE)), array(), 'GET', NULL, 1); + $redirect_invalid = drupal_http_request(url('system-test/redirect-invalid-scheme', array('absolute' => TRUE)), array('max_redirects' => 1)); $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); + $redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array('max_redirects' => 1)); $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); + $redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array('max_redirects' => 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); + $redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array('max_redirects' => 1)); $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.')); + $redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array('max_redirects' => 0)); + $this->assertFalse(isset($redirect_307->redirect_code), t('drupal_http_request does not follow 307 redirect if max_redirects = 0.')); } function testDrupalGetDestination() { |