diff options
author | tailor <cygnus@janrain.com> | 2007-05-22 21:49:46 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-05-22 21:49:46 +0000 |
commit | 322b7685c4f57078ff9f1cece6469d634d3210e9 (patch) | |
tree | 494cc9ad9075ccf0fdb6cb264c6aa2b72859a0f8 /Auth | |
parent | 3523706f395c807e5b7eba4f32b7eda1050a45b7 (diff) | |
download | php-openid-322b7685c4f57078ff9f1cece6469d634d3210e9.zip php-openid-322b7685c4f57078ff9f1cece6469d634d3210e9.tar.gz php-openid-322b7685c4f57078ff9f1cece6469d634d3210e9.tar.bz2 |
[project @ Skip SSL identity and server URLs when SSL support absent]
Diffstat (limited to 'Auth')
-rw-r--r-- | Auth/OpenID/Discover.php | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/Auth/OpenID/Discover.php b/Auth/OpenID/Discover.php index da4a117..e72c744 100644 --- a/Auth/OpenID/Discover.php +++ b/Auth/OpenID/Discover.php @@ -434,11 +434,34 @@ function Auth_OpenID_discoverXRI($iname, &$fetcher) function Auth_OpenID_discover($uri, &$fetcher) { + // If the fetcher (i.e., PHP) doesn't support SSL, we can't do + // discovery on an HTTPS URL. + if ($fetcher->isHTTPS($uri) && !$fetcher->supportsSSL()) { + return array($uri, array()); + } + if (Auth_Yadis_identifierScheme($uri) == 'XRI') { - return Auth_OpenID_discoverXRI($uri, $fetcher); + $result = Auth_OpenID_discoverXRI($uri, $fetcher); } else { - return Auth_OpenID_discoverURI($uri, $fetcher); + $result = Auth_OpenID_discoverURI($uri, $fetcher); + } + + // If the fetcher doesn't support SSL, we can't interact with + // HTTPS server URLs; remove those endpoints from the list. + if (!$fetcher->supportsSSL()) { + $http_endpoints = array(); + list($new_uri, $endpoints) = $result; + + foreach ($endpoints as $e) { + if (!$fetcher->isHTTPS($e->server_url)) { + $http_endpoints[] = $e; + } + } + + $result = array($new_uri, $http_endpoints); } + + return $result; } ?>
\ No newline at end of file |