summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-04-01 23:01:21 -0400
committerDavid Rothstein <drothstein@gmail.com>2013-04-01 23:01:21 -0400
commit025ad199b53fbe8db4c71f59f8493e61116b5e46 (patch)
treeb987682c6b7847dea3b8070250d449de2f2dd4c7
parent7cbe4b7e265343773c2cd2e50b86c68182a64f8e (diff)
downloadbrdo-025ad199b53fbe8db4c71f59f8493e61116b5e46.tar.gz
brdo-025ad199b53fbe8db4c71f59f8493e61116b5e46.tar.bz2
Issue #1664784 by effulgentsia, mikeytown2: Allow drupal_http_request() to be overridden.
-rw-r--r--CHANGELOG.txt2
-rw-r--r--includes/common.inc7
2 files changed, 9 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index e6c15c9f3..b3f02c5cb 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,8 @@
Drupal 7.22, xxxx-xx-xx (development version)
-----------------------
+- Allowed the drupal_http_request() function to be overridden so that
+ additional HTTP request capabilities can be added by contributed modules.
- Changed the Simpletest module to allow PSR-0 test classes to be used in
Drupal 7.
- Removed an unnecessary "Content-Disposition" header from private file
diff --git a/includes/common.inc b/includes/common.inc
index d6fd67eeb..27fa190e0 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -785,6 +785,13 @@ function drupal_access_denied() {
* - data: A string containing the response body that was received.
*/
function drupal_http_request($url, array $options = array()) {
+ // Allow an alternate HTTP client library to replace Drupal's default
+ // implementation.
+ $override_function = variable_get('drupal_http_request_function', FALSE);
+ if (!empty($override_function) && function_exists($override_function)) {
+ return $override_function($url, $options);
+ }
+
$result = new stdClass();
// Parse the URL and make sure we can handle the schema.