Index: modules/openid/openid.test =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.test,v retrieving revision 1.31 diff -u -p -r1.31 openid.test --- modules/openid/openid.test 22 Aug 2010 22:00:16 -0000 1.31 +++ modules/openid/openid.test 3 Oct 2010 09:17:43 -0000 @@ -47,6 +47,8 @@ class OpenIDFunctionalTestCase extends O * Test discovery of OpenID Provider Endpoint via Yadis and HTML. */ function testDiscovery() { + global $is_https; + $this->drupalLogin($this->web_user); // The User-supplied Identifier entered by the user may indicate the URL of @@ -94,7 +96,7 @@ class OpenIDFunctionalTestCase extends O // Identifier is an XRI. Resolve using our own dummy proxy resolver. variable_set('xri_proxy_resolver', url('openid-test/yadis/xrds/xri', array('absolute' => TRUE)) . '/'); - $this->addIdentity('@example*résumé;%25', 2, 'http://example.com/xrds', 'http://example.com/user'); + $this->addIdentity('@example*résumé;%25', 2, 'http://example.com/xrds', ($is_https ? 'https' : 'http') . '://example.com/user'); // Make sure that unverified CanonicalID are not trusted. variable_set('openid_test_canonical_id_status', 'bad value'); Index: modules/openid/tests/openid_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/tests/openid_test.module,v retrieving revision 1.17 diff -u -p -r1.17 openid_test.module --- modules/openid/tests/openid_test.module 7 Jul 2010 08:05:01 -0000 1.17 +++ modules/openid/tests/openid_test.module 3 Oct 2010 09:17:43 -0000 @@ -312,3 +312,27 @@ function _openid_test_endpoint_authentic drupal_add_http_header('Content-Type', 'text/plain'); header('Location: ' . url($_REQUEST['openid_return_to'], array('query' => $response, 'external' => TRUE))); } + +/** + * Replaces the URL normalization method on HTTPS test environments. + */ +function openid_test_openid_normalization_method_info_alter(&$methods) { + global $is_https; + if ($is_https) { + $methods['url'] = '_openid_test_https_normalize'; + } +} + +/** + * Allows tests to pass on HTTPS test environments by rewriting URLs as HTTPS. + * + * Normalizing to HTTPS does not follow the OpenID spec, but works around + * assumptions in the OpenID tests that normalized HTTP URLs can be used. + */ +function _openid_test_https_normalize($url) { + $url = _openid_url_normalize($url); + if (strpos($url, 'http://') === 0) { + $url = substr_replace($url, 's', 4, 0); + } + return $url; +}