Skip to content

Commit 062a5f4

Browse files
author
Josh Hoyt
committed
[project @ Make sure that no services will be returned for an XRI whose XRD does not have a CanonicalID element]
1 parent f1c19bf commit 062a5f4

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎openid/test/test_discover.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ class TestXRIDiscovery(BaseTestDiscovery):
469469
fetcherClass = MockFetcherForXRIProxy
470470

471471
documents = {'=smoker': ('application/xrds+xml',
472-
readDataFile('yadis_2entries_delegate.xml')) }
472+
readDataFile('yadis_2entries_delegate.xml')),
473+
'=smoker*bad': ('application/xrds+xml',
474+
readDataFile('yadis_another_delegate.xml')) }
473475

474476
def test_xri(self):
475477
user_xri, services = discover.discoverXRI('=smoker')
@@ -494,6 +496,10 @@ def test_xri(self):
494496
local_id='http://frank.livejournal.com/',
495497
)
496498

499+
def test_xriNoCanonicalID(self):
500+
user_xri, services = discover.discoverXRI('=smoker*bad')
501+
self.failIf(services)
502+
497503
def test_useCanonicalID(self):
498504
"""When there is no delegate, the CanonicalID should be used with XRI.
499505
"""

‎openid/yadis/xrires.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def query(self, xri, service_types):
7676
# Make a seperate request to the proxy resolver for each service
7777
# type, as, if it is following Refs, it could return a different
7878
# XRDS for each.
79+
80+
canonicalID = None
81+
7982
for service_type in service_types:
8083
url = self.queryURL(xri, service_type)
8184
response = fetchers.fetch(url)

0 commit comments

Comments
 (0)