Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.257 diff -u -p -r1.257 bootstrap.inc --- includes/bootstrap.inc 3 Dec 2008 14:51:53 -0000 1.257 +++ includes/bootstrap.inc 16 Dec 2008 20:47:19 -0000 @@ -417,7 +417,7 @@ function drupal_initialize_variables() { */ function drupal_valid_http_host() { $_SERVER['HTTP_HOST'] = strtolower($_SERVER['HTTP_HOST']); - return preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $_SERVER['HTTP_HOST']); + return empty($_SERVER['HTTP_HOST']) || preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $_SERVER['HTTP_HOST']); } /** Index: modules/simpletest/tests/bootstrap.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/bootstrap.test,v retrieving revision 1.9 diff -u -p -r1.9 bootstrap.test --- modules/simpletest/tests/bootstrap.test 3 Dec 2008 14:51:53 -0000 1.9 +++ modules/simpletest/tests/bootstrap.test 16 Dec 2008 20:47:19 -0000 @@ -68,7 +68,7 @@ class BootstrapIPAddressTestCase extends // Cluster environment. $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] = $this->cluster_ip; $this->assertTrue( - ip_address(true) == $this->cluster_ip, + ip_address(TRUE) == $this->cluster_ip, t('Cluster environment got cluster client IP') ); $_SERVER['HTTP_HOST'] = 'security/.drupal.org:80'; @@ -81,6 +81,8 @@ class BootstrapIPAddressTestCase extends $this->assertFalse(drupal_valid_http_host(), t('HTTP_HOST with .. is invalid')); $_SERVER['HTTP_HOST'] = '[::1]:80'; // IPv6 loopback address $this->assertTrue(drupal_valid_http_host(), t('HTTP_HOST containing IPv6 loopback is valid')); + $_SERVER['HTTP_HOST'] = ''; + $this->assertTrue(drupal_valid_http_host(), t('Empty HTTP_HOST is valid')); } }