$this->assertEqual($redirect_invalid->code,-1002,format_string('301 redirect to protocol-relative URL returned with error code !error.',array('!error'=>$redirect_invalid->error)));
$this->assertEqual($redirect_invalid->error,'missing schema',format_string('301 redirect to protocol-relative URL returned with error message "!error".',array('!error'=>$redirect_invalid->error)));
$this->assertEqual($redirect_invalid->code,-1002,format_string('301 redirect to invalid URL returned with error code !error.',array('!error'=>$redirect_invalid->error)));
$this->assertEqual($redirect_invalid->error,'missing schema',format_string('301 redirect to invalid URL returned with error message "!error".',array('!error'=>$redirect_invalid->error)));
@@ -1246,6 +1250,44 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
'description'=>'Perform unit tests on processing of http redirects.',
'group'=>'System',
);
}
publicfunctiontestHttpsDowngrade(){
$url='https://example.com/foo';
$location='http://example.com/bar';
$this->assertTrue(_drupal_should_strip_sensitive_headers_on_http_redirect($url,$location),'Sensitive headers are stripped on HTTPS downgrade.');
}
publicfunctiontestNoHttpsDowngrade(){
$url='https://example.com/foo';
$location='https://example.com/bar';
$this->assertFalse(_drupal_should_strip_sensitive_headers_on_http_redirect($url,$location),'Sensitive headers are not stripped without HTTPS downgrade.');
}
publicfunctiontestHostChange(){
$url='https://example.com/foo';
$location='https://www.example.com/bar';
$this->assertTrue(_drupal_should_strip_sensitive_headers_on_http_redirect($url,$location),'Sensitive headers are stripped on change of host.');
}
publicfunctiontestNoHostChange(){
$url='http://example.com/foo';
$location='http://example.com/bar';
$this->assertFalse(_drupal_should_strip_sensitive_headers_on_http_redirect($url,$location),'Sensitive headers are not stripped without change of host.');