summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-06-24 22:09:52 +0000
committerDries Buytaert <dries@buytaert.net>2008-06-24 22:09:52 +0000
commit6aea1d08736936a7181ee5bcdfe384c802ce5e0a (patch)
treeabfcfdd5a599104d0a807898a3e54d4c4ea36897 /includes
parent5efec92ac3979fe36e9fdc2093e060fe5648be59 (diff)
downloadbrdo-6aea1d08736936a7181ee5bcdfe384c802ce5e0a.tar.gz
brdo-6aea1d08736936a7181ee5bcdfe384c802ce5e0a.tar.bz2
- Patch #260778 by boombatower et al: play a user agent trick to make the tests work.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc11
1 files changed, 11 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 3296d98c1..9ec58b08e 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -414,6 +414,7 @@ function drupal_access_denied() {
* data and redirect status.
*/
function drupal_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3) {
+ global $db_prefix;
static $self_test = FALSE;
$result = new stdClass();
// Try to clear the drupal_http_request_fails variable if it's set. We
@@ -482,6 +483,16 @@ function drupal_http_request($url, $headers = array(), $method = 'GET', $data =
$defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));
}
+ // If the database prefix is being used by SimpleTest to run the tests in a copied
+ // database then set the user-agent header to the database prefix so that any
+ // calls to other Drupal pages will run the SimpleTest prefixed database. The
+ // user-agent is used to ensure that multiple testing sessions running at the
+ // same time won't interfere with each other as they would if the database
+ // prefix were stored statically in a file or database variable.
+ if (preg_match("/^simpletest\d+/", $db_prefix)) {
+ $headers['User-Agent'] = $db_prefix;
+ }
+
foreach ($headers as $header => $value) {
$defaults[$header] = $header . ': ' . $value;
}