Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The common.test contains this function.
function testDrupalHTTPRequestBasicAuth() {
$username = $this->randomName();
$password = $this->randomName();
$url = url('system-test/auth', array('absolute' => TRUE));
$auth = str_replace('://', '://' . $username . ':' . $password . '@', $url);
$result = drupal_http_request($auth);
$this->drupalSetContent($result->data);
$this->assertRaw($username, t('$_SERVER["PHP_AUTH_USER"] is passed correctly.'));
$this->assertRaw($password, t('$_SERVER["PHP_AUTH_PW"] is passed correctly.'));
}
HTTP auth is not supported in PHP CGI, causing this test to be a guaranteed failure. This test should either be conditional on detection of PHP running in Apache, or Drupal needs to employ the workaround for using HTTP auth in CGI.
Comments
Comment #1
cburschkaI am not altogether sure, but it is possible that this failure is also related to CGI.
There is not a single occurrence of an 'if-none-match' header in Drupal's code (outside tests and comments), so Drupal appears to be testing its environment rather than itself. It might be a version-specific bug in PHP or Apache, too.
In any case, the above request returns a 304 not-modified on my test environment.
Comment #2
Damien Tournoud CreditAttribution: Damien Tournoud commentedLet's only mark issues with "Testing broken" if the test bot is broken. This is not the case here. PHP/(Fast)CGI is not the default test environment.
I agree we need to fix the first issue. The second issue seems different enough to warrant its own issue ticket.
Comment #3
cburschkaAlso, there is not an "If-None-Match", but there is an "HTTP_IF_NONE_MATCH".
Comment #4
cburschkaThis bug will be fixed if the following feature is added:
#670454: Support HTTP Authorization in CGI environment
Comment #5
sunEither fixed by #670454: Support HTTP Authorization in CGI environment already or will be fixed by #2157017: D7: DrupalHTTPRequestTestCase breaks on php-fpm [testbot PHP 5.4 blocker]