summaryrefslogtreecommitdiffabout
path: root/lib/discovery.cc
Side-by-side diff
Diffstat (limited to 'lib/discovery.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/discovery.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/discovery.cc b/lib/discovery.cc
index a35ce32..1f23ff1 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -86,35 +86,37 @@ namespace opkele {
string::size_type fsc = identity.find_first_not_of(whitespace);
if(fsc==string::npos)
throw bad_input(OPKELE_CP_ "whtiespace-only identity");
string::size_type lsc = identity.find_last_not_of(whitespace);
assert(lsc!=string::npos);
if(!strncasecmp(identity.c_str()+fsc,"xri://",sizeof("xri://")-1))
fsc += sizeof("xri://")-1;
if((fsc+1)>=lsc)
throw bad_input(OPKELE_CP_ "not a character of importance in identity");
string id(identity,fsc,lsc-fsc+1);
if(strchr(i_leaders,id[0])) {
result.normalized_id = id;
+ result.xri_identity = true;
/* TODO: further canonicalize xri identity? Like folding case or whatever... */
discover_at(
result,
xri_proxy + util::url_encode(id)+
"?_xrd_r=application/xrd+xml;sep=false", xmode_xrd);
if(status_code!=100)
throw failed_xri_resolution(OPKELE_CP_
"XRI resolution failed with '"+status_string+"' message",status_code);
if(result.xrd.canonical_ids.empty())
throw opkele::failed_discovery(OPKELE_CP_ "No CanonicalID for XRI identity found");
}else{
+ result.xri_identity = false;
if(id.find("://")==string::npos)
id.insert(0,"http://");
string::size_type fp = id.find('#');
if(fp!=string::npos) {
string::size_type qp = id.find('?');
if(qp==string::npos || qp<fp)
id.erase(fp);
else if(qp>fp)
id.erase(fp,qp-fp);
}
result.normalized_id = util::rfc_3986_normalize_uri(id);
discover_at(result,id,xmode_html|xmode_xrd);