Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fetch the XRDS one time for all service types

  • Loading branch information...
commit 8e979da19e47a59f93ce9acb5a3b5d535924198d 1 parent 8f49a81
Mike Mell authored chowells79 committed
Showing with 5 additions and 13 deletions.
  1. +1 −2  lib/openid/consumer/discovery.rb
  2. +4 −11 lib/openid/yadis/xrires.rb
View
3  lib/openid/consumer/discovery.rb
@@ -421,8 +421,7 @@ def self.discover_xri(iname)
iname = self.normalize_xri(iname)
begin
- canonical_id, services = Yadis::XRI::ProxyResolver.new().query(
- iname, OpenIDServiceEndpoint::OPENID_TYPE_URIS)
+ canonical_id, services = Yadis::XRI::ProxyResolver.new().query( iname )
if canonical_id.nil?
raise Yadis::XRDSError.new(sprintf('No CanonicalID found for XRI %s', iname))
View
15 lib/openid/yadis/xrires.rb
@@ -42,34 +42,27 @@ def query_url(xri, service_type=nil)
return XRI.append_args(hxri, args)
end
- def query(xri, service_types)
+ def query(xri)
# these can be query args or http headers, needn't be both.
# headers = {'Accept' => 'application/xrds+xml;sep=true'}
canonicalID = nil
- services = service_types.collect { |service_type|
- url = self.query_url(xri, service_type)
+ url = self.query_url(xri)
begin
response = OpenID.fetch(url)
rescue
- raise XRIHTTPError, ["Could not fetch #{xri}", $!]
+ raise XRIHTTPError, "Could not fetch #{xri}, #{$!}"
end
raise XRIHTTPError, "Could not fetch #{xri}" if response.nil?
xrds = Yadis::parseXRDS(response.body)
canonicalID = Yadis::get_canonical_id(xri, xrds)
- Yadis::services(xrds) unless xrds.nil?
- }
+ return canonicalID, Yadis::services(xrds)
# TODO:
# * If we do get hits for multiple service_types, we're almost
# certainly going to have duplicated service entries and
# broken priority ordering.
- services = services.inject([]) { |flatter, some_services|
- flatter += some_services unless some_services.nil?
- }
-
- return canonicalID, services
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.