summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/discovery.h1
-rw-r--r--lib/discovery.cc2
-rw-r--r--test/idiscover.cc1
3 files changed, 4 insertions, 0 deletions
diff --git a/include/opkele/discovery.h b/include/opkele/discovery.h
index 5d7129b..7865fb2 100644
--- a/include/opkele/discovery.h
+++ b/include/opkele/discovery.h
@@ -12,6 +12,7 @@ namespace opkele {
12 void idiscover(idiscovery_t& result,const string& identity); 12 void idiscover(idiscovery_t& result,const string& identity);
13 13
14 struct idiscovery_t { 14 struct idiscovery_t {
15 bool xri_identity;
15 string normalized_id; 16 string normalized_id;
16 string canonicalized_id; 17 string canonicalized_id;
17 xrd::XRD_t xrd; 18 xrd::XRD_t xrd;
diff --git a/lib/discovery.cc b/lib/discovery.cc
index a35ce32..1f23ff1 100644
--- a/lib/discovery.cc
+++ b/lib/discovery.cc
@@ -95,6 +95,7 @@ namespace opkele {
95 string id(identity,fsc,lsc-fsc+1); 95 string id(identity,fsc,lsc-fsc+1);
96 if(strchr(i_leaders,id[0])) { 96 if(strchr(i_leaders,id[0])) {
97 result.normalized_id = id; 97 result.normalized_id = id;
98 result.xri_identity = true;
98 /* TODO: further canonicalize xri identity? Like folding case or whatever... */ 99 /* TODO: further canonicalize xri identity? Like folding case or whatever... */
99 discover_at( 100 discover_at(
100 result, 101 result,
@@ -106,6 +107,7 @@ namespace opkele {
106 if(result.xrd.canonical_ids.empty()) 107 if(result.xrd.canonical_ids.empty())
107 throw opkele::failed_discovery(OPKELE_CP_ "No CanonicalID for XRI identity found"); 108 throw opkele::failed_discovery(OPKELE_CP_ "No CanonicalID for XRI identity found");
108 }else{ 109 }else{
110 result.xri_identity = false;
109 if(id.find("://")==string::npos) 111 if(id.find("://")==string::npos)
110 id.insert(0,"http://"); 112 id.insert(0,"http://");
111 string::size_type fp = id.find('#'); 113 string::size_type fp = id.find('#');
diff --git a/test/idiscover.cc b/test/idiscover.cc
index 2abedc9..05cbcae 100644
--- a/test/idiscover.cc
+++ b/test/idiscover.cc
@@ -36,6 +36,7 @@ int main(int argc,char **argv) {
36 << "User-supplied ID: " << argv[a] << endl 36 << "User-supplied ID: " << argv[a] << endl
37 << "Normalized ID: " << discovery.normalized_id << endl 37 << "Normalized ID: " << discovery.normalized_id << endl
38 << "Canonicalized ID: " << discovery.canonicalized_id << endl 38 << "Canonicalized ID: " << discovery.canonicalized_id << endl
39 << "The identity is " << (discovery.xri_identity?"":"not ") << "an i-name" << endl
39 << endl 40 << endl
40 << "CanonicalID: " << discovery.xrd.canonical_ids << endl 41 << "CanonicalID: " << discovery.xrd.canonical_ids << endl
41 << "LocalID: " << discovery.xrd.local_ids << endl 42 << "LocalID: " << discovery.xrd.local_ids << endl