From a6b4f0897dcbdd0328f0781ef2d0eb9596411113 Mon Sep 17 00:00:00 2001 From: Lilli Date: Fri, 12 Feb 2010 12:26:10 -0800 Subject: [PATCH] Added the following patch from the dev@openidenabled.com mailing list: http://lists.openidenabled.com/pipermail/dev/attachments/20090206/f0d91666/attachment-0001.bin Original Message: will at willnorris.com will at willnorris.com Fri Feb 6 14:56:12 PST 2009 darcs patch: Properly handle Yadis discovery failure "The library does not curently handle failures during Yadis discovery properly. Specifically, if Yadis discovery fails, and discovery WAS being done with an XRDS document, then non-Yadis discovery should be attempted. The use-case I'm dealing with right now that exposes this bug is when an XRDS document location is advertised (via HTTP response header or HTML tag), but the document is not able to be retrieved for whatever reason. The library is failing in this case, instead of continuing to attempt non-Yadis discovery. This patch includes two changes: - change to Yadis/Yadis.php that properly detects if XRDS was used - change to OpenID/Discovery.php that prevents discovery from halting in the above example" This patch was in the form of a Darcs patch, not a normal patch. So solve this, I applied it to the Darcs repository found on openidenabled, then created a new diff file between the original Darcs repo and the new one (with the patch applied) so that I could apply it to this git repo. All hunks were applied successfully. --- Auth/OpenID/Discover.php | 2 +- Auth/Yadis/Yadis.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Auth/OpenID/Discover.php b/Auth/OpenID/Discover.php index 34bdae5..efd4a74 100644 --- a/Auth/OpenID/Discover.php +++ b/Auth/OpenID/Discover.php @@ -496,7 +496,7 @@ function Auth_OpenID_discoverWithYadis($uri, &$fetcher, $yadis_url = $response->normalized_uri; $yadis_services = array(); - if ($response->isFailure()) { + if ($response->isFailure() && !$response->isXRDS()) { return array($uri, array()); } diff --git a/Auth/Yadis/Yadis.php b/Auth/Yadis/Yadis.php index 43cd25d..6b87c0f 100644 --- a/Auth/Yadis/Yadis.php +++ b/Auth/Yadis/Yadis.php @@ -105,7 +105,7 @@ function services() function usedYadisLocation() { // Was the Yadis protocol's indirection used? - return $this->normalized_uri != $this->xrds_uri; + return ($this->xrds_uri && $this->normalized_uri != $this->xrds_uri); } function isXRDS()