summaryrefslogtreecommitdiff
path: root/modules/system/system.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-24 09:59:22 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-24 09:59:22 +0000
commit821ad24bc10fc122e7597026dfa39b770d39c0a5 (patch)
tree069d457197a91620f707a71ee6ce501588c20ad0 /modules/system/system.module
parente5ddb46d12c03967ec738db70dfce4fccb5128eb (diff)
downloadbrdo-821ad24bc10fc122e7597026dfa39b770d39c0a5.tar.gz
brdo-821ad24bc10fc122e7597026dfa39b770d39c0a5.tar.bz2
- Patch #245990 by kellyllek, chx, dww: improved the HTTP request test to be more robust.
Diffstat (limited to 'modules/system/system.module')
-rw-r--r--modules/system/system.module25
1 files changed, 4 insertions, 21 deletions
diff --git a/modules/system/system.module b/modules/system/system.module
index 3e77dde00..cc5282a96 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -661,15 +661,6 @@ function system_menu() {
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
- // Menu handler to test that drupal_http_request() works locally.
- // @see system_check_http_request()
- $items['admin/reports/request-test'] = array(
- 'title' => 'Request test',
- 'page callback' => 'printf',
- 'page arguments' => array('request test'),
- 'access callback' => TRUE,
- 'type' => MENU_CALLBACK,
- );
// Reports:
$items['admin/reports'] = array(
@@ -2184,20 +2175,12 @@ function system_time_zones($blank = NULL) {
* will contain an error.
*
* @return
- * Whether the admin/reports/request-test page can be requested via HTTP
- * and contains the same output as if called via the menu system.
+ * Whether the www.example.com page can be requested via HTTP.
*/
function system_check_http_request() {
- // Check whether we can do any request at all. First get the results for
- // a very simple page which has access TRUE set via the menu system. Then,
- // try to drupal_http_request() the same page and compare.
- ob_start();
- $path = 'admin/reports/request-test';
- menu_execute_active_handler($path);
- $nothing = ob_get_contents();
- ob_end_clean();
- $result = drupal_http_request(url($path, array('absolute' => TRUE)));
- $works = isset($result->data) && $result->data == $nothing;
+ $result = drupal_http_request('http://www.example.com');
+ // If the resulting page contains RFC 2606 then we got the page we wanted.
+ $works = isset($result->data) && preg_match('/RFC\s+2606/', $result->data);
variable_set('drupal_http_request_fails', !$works);
return $works;
}