-rw-r--r-- | lib/discovery.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc index 3b184ee..bc7d6fb 100644 --- a/lib/discovery.cc +++ b/lib/discovery.cc | |||
@@ -95,24 +95,25 @@ namespace opkele { | |||
95 | result.normalized_id = id; | 95 | result.normalized_id = id; |
96 | result.xri_identity = true; | 96 | result.xri_identity = true; |
97 | /* TODO: further canonicalize xri identity? Like folding case or whatever... */ | 97 | /* TODO: further canonicalize xri identity? Like folding case or whatever... */ |
98 | discover_at( | 98 | discover_at( |
99 | result, | 99 | result, |
100 | xri_proxy + util::url_encode(id)+ | 100 | xri_proxy + util::url_encode(id)+ |
101 | "?_xrd_r=application/xrd+xml;sep=false", xmode_xrd); | 101 | "?_xrd_r=application/xrd+xml;sep=false", xmode_xrd); |
102 | if(status_code!=100) | 102 | if(status_code!=100) |
103 | throw failed_xri_resolution(OPKELE_CP_ | 103 | throw failed_xri_resolution(OPKELE_CP_ |
104 | "XRI resolution failed with '"+status_string+"' message",status_code); | 104 | "XRI resolution failed with '"+status_string+"' message",status_code); |
105 | if(result.xrd.canonical_ids.empty()) | 105 | if(result.xrd.canonical_ids.empty()) |
106 | throw opkele::failed_discovery(OPKELE_CP_ "No CanonicalID for XRI identity found"); | 106 | throw opkele::failed_discovery(OPKELE_CP_ "No CanonicalID for XRI identity found"); |
107 | result.canonicalized_id = result.xrd.canonical_ids.begin()->second; | ||
107 | }else{ | 108 | }else{ |
108 | result.xri_identity = false; | 109 | result.xri_identity = false; |
109 | if(id.find("://")==string::npos) | 110 | if(id.find("://")==string::npos) |
110 | id.insert(0,"http://"); | 111 | id.insert(0,"http://"); |
111 | string::size_type fp = id.find('#'); | 112 | string::size_type fp = id.find('#'); |
112 | if(fp!=string::npos) { | 113 | if(fp!=string::npos) { |
113 | string::size_type qp = id.find('?'); | 114 | string::size_type qp = id.find('?'); |
114 | if(qp==string::npos || qp<fp) | 115 | if(qp==string::npos || qp<fp) |
115 | id.erase(fp); | 116 | id.erase(fp); |
116 | else if(qp>fp) | 117 | else if(qp>fp) |
117 | id.erase(fp,qp-fp); | 118 | id.erase(fp,qp-fp); |
118 | } | 119 | } |