Skip to content

Commit

Permalink
remove ;sep=false option since we want all of the OpenID endpoints in…
Browse files Browse the repository at this point in the history
… a single request
  • Loading branch information
Mike Mell committed Feb 24, 2011
1 parent 49f838b commit 7ea23fb
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions lib/openid/yadis/xrires.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,29 @@ def query_url(xri, service_type=nil)
# XRI Resolution WD 11.
qxri = XRI.to_uri_normal(xri)[6..-1]
hxri = @proxy_url + CGI::escape( qxri )
args = {'_xrd_r' => 'application/xrds+xml'}
if service_type
args['_xrd_t'] = service_type
else
# don't perform service endpoint selection
args['_xrd_r'] += ';sep=false'
end
args = {'_xrd_r' => 'application/xrds+xml'}
args['_xrd_t'] = service_type if service_type

return XRI.append_args(hxri, args)
end

def query(xri)
# these can be query args or http headers, needn't be both.
# headers = {'Accept' => 'application/xrds+xml;sep=true'}
canonicalID = nil

url = self.query_url(xri)
begin
response = OpenID.fetch(url)
rescue
raise XRIHTTPError, "Could not fetch #{xri}, #{$!}"
end
begin
response = OpenID.fetch(url)
rescue
raise XRIHTTPError, "Could not fetch #{xri}, #{$!}"
end
raise XRIHTTPError, "Fetching #{xri} returned nothing" if response.nil?

xrds = Yadis::parseXRDS(response.body)
xrds = Yadis::parseXRDS(response.body)
raise XRIHTTPError, "Fetching #{xri} did not return an XRDS" if xrds.nil?
canonicalID = Yadis::get_canonical_id(xri, xrds)
canonicalID = Yadis::get_canonical_id(xri, xrds)

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.
end
end

Expand Down

0 comments on commit 7ea23fb

Please sign in to comment.