summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/discovery.h10
-rw-r--r--lib/discovery.cc29
2 files changed, 31 insertions, 8 deletions
diff --git a/include/opkele/discovery.h b/include/opkele/discovery.h
index ab4b9d9..677d7bb 100644
--- a/include/opkele/discovery.h
+++ b/include/opkele/discovery.h
@@ -37,3 +37,11 @@ namespace opkele {
37 typedef set<string> types_t; 37 typedef set<string> types_t;
38 typedef priority_map<string> uris_t; 38 struct uri_t {
39 string uri;
40 string append;
41
42 uri_t() { }
43 uri_t(const string& u) : uri(u) { }
44 uri_t(const string& u,const string& a) : uri(u), append(a) { }
45 };
46 typedef priority_map<uri_t> uris_t;
39 47
diff --git a/lib/discovery.cc b/lib/discovery.cc
index 93409f4..6e20654 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -61,2 +61,11 @@ namespace opkele {
61 } 61 }
62 /* TODO: ideally all attributes should be
63 * retrieved in one run */
64 static const char *element_attr(const XML_Char **a, const char *at) {
65 for(;*a;++a)
66 if(!strcasecmp(*(a++),at)) {
67 return *a;
68 }
69 return 0;
70 }
62 71
@@ -120,4 +129,3 @@ namespace opkele {
120 * or whatever... */ 129 * or whatever... */
121 rv = idis.normalized_id = id; 130 rv = id;
122 idis.xri_identity = true;
123 set<string> cids; 131 set<string> cids;
@@ -157,2 +165,3 @@ namespace opkele {
157 idis.canonicalized_id = cid; 165 idis.canonicalized_id = cid;
166 idis.normalized_id = rv; idis.xri_identity = true;
158 queue_endpoints(oi,idis,st); 167 queue_endpoints(oi,idis,st);
@@ -197,3 +206,2 @@ namespace opkele {
197 void discover_at(idiscovery_t& idis,const string& url,int xm) { 206 void discover_at(idiscovery_t& idis,const string& url,int xm) {
198 DOUT_("Doing discovery at " << url);
199 CURLcode r = easy_setopt(CURLOPT_URL,url.c_str()); 207 CURLcode r = easy_setopt(CURLOPT_URL,url.c_str());
@@ -392,3 +400,5 @@ namespace opkele {
392 assert(xrd); assert(xrd_service); 400 assert(xrd); assert(xrd_service);
393 cdata = &(xrd_service->uris.add(element_priority(a),string())); 401 const char *append = element_attr(a,"append");
402 xrd::uri_t& uri = xrd_service->uris.add(element_priority(a),xrd::uri_t("",append?append:""));
403 cdata = &uri.uri;
394 }else if(is_qelement(n,NSURI_XRD "\tLocalID") 404 }else if(is_qelement(n,NSURI_XRD "\tLocalID")
@@ -486,3 +496,3 @@ namespace opkele {
486 if(rel=="openid.server") 496 if(rel=="openid.server")
487 html_openid1.uris.add(-1,href); 497 html_openid1.uris.add(-1,xrd::uri_t(href));
488 else if(rel=="openid.delegate") 498 else if(rel=="openid.delegate")
@@ -490,3 +500,3 @@ namespace opkele {
490 else if(rel=="openid2.provider") 500 else if(rel=="openid2.provider")
491 html_openid2.uris.add(-1,href); 501 html_openid2.uris.add(-1,xrd::uri_t(href));
492 else if(rel=="openid2.local_id") 502 else if(rel=="openid2.local_id")
@@ -509,3 +519,8 @@ namespace opkele {
509 for(xrd::uris_t::const_iterator iu=svc.uris.begin();iu!=svc.uris.end();++iu) { 519 for(xrd::uris_t::const_iterator iu=svc.uris.begin();iu!=svc.uris.end();++iu) {
510 ep.uri = iu->second; 520 ep.uri = iu->second.uri;
521 if(id.xri_identity) {
522 if(iu->second.append=="qxri") {
523 ep.uri += id.normalized_id;
524 } /* TODO: else handle other append attribute values */
525 }
511 if(st->forceid) { 526 if(st->forceid) {