summaryrefslogtreecommitdiffabout
path: root/lib/message.cc
Unidiff
Diffstat (limited to 'lib/message.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--lib/message.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/message.cc b/lib/message.cc
index 524946a..c1f8088 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -137,49 +137,49 @@ namespace opkele {
137 signeds.append(fields,fnc,fields.size()-fnc); 137 signeds.append(fields,fnc,fields.size()-fnc);
138 } 138 }
139 } 139 }
140 }catch(failed_lookup&) { 140 }catch(failed_lookup&) {
141 signeds.assign(fields,fnc,fields.size()-fnc); 141 signeds.assign(fields,fnc,fields.size()-fnc);
142 } 142 }
143 set_field("signed",signeds); 143 set_field("signed",signeds);
144 } 144 }
145 145
146 string basic_openid_message::find_ns(const string& uri,const char *pfx) const { 146 string basic_openid_message::find_ns(const string& uri,const char *pfx) const {
147 try { 147 try {
148 return get_ns(uri); 148 return get_ns(uri);
149 }catch(failed_lookup&) { 149 }catch(failed_lookup&) {
150 return pfx; 150 return pfx;
151 } 151 }
152 } 152 }
153 string basic_openid_message::allocate_ns(const string& uri,const char *pfx) { 153 string basic_openid_message::allocate_ns(const string& uri,const char *pfx) {
154 if(!has_field("ns")) 154 if(!has_field("ns"))
155 return pfx; 155 return pfx;
156 if(has_ns(uri)) 156 if(has_ns(uri))
157 throw bad_input(OPKELE_CP_ "OpenID message already contains namespace"); 157 throw bad_input(OPKELE_CP_ "OpenID message already contains namespace");
158 string rv = pfx; 158 string rv = pfx;
159 if(has_field("ns."+rv)) { 159 if(has_field("ns."+rv)) {
160 string::reference c=rv[rv.length()]; 160 string::reference c=rv[rv.length()];
161 for(c='a';c<='z' && has_field("ns."+rv);++c); 161 for(c='a';c<='z' && has_field("ns."+rv);++c) ;
162 if(c=='z') 162 if(c=='z')
163 throw exception(OPKELE_CP_ "Failed to allocate namespace"); 163 throw exception(OPKELE_CP_ "Failed to allocate namespace");
164 } 164 }
165 set_field("ns."+rv,uri); 165 set_field("ns."+rv,uri);
166 return rv; 166 return rv;
167 } 167 }
168 168
169 bool openid_message_t::has_field(const string& n) const { 169 bool openid_message_t::has_field(const string& n) const {
170 return find(n)!=end(); 170 return find(n)!=end();
171 } 171 }
172 const string& openid_message_t::get_field(const string& n) const { 172 const string& openid_message_t::get_field(const string& n) const {
173 const_iterator i=find(n); 173 const_iterator i=find(n);
174 if(i==end()) 174 if(i==end())
175 throw failed_lookup(OPKELE_CP_ n+": no such field"); 175 throw failed_lookup(OPKELE_CP_ n+": no such field");
176 return i->second; 176 return i->second;
177 } 177 }
178 178
179 openid_message_t::fields_iterator openid_message_t::fields_begin() const { 179 openid_message_t::fields_iterator openid_message_t::fields_begin() const {
180 return util::map_keys_iterator<const_iterator,string,const string&,const string*>(begin(),end()); 180 return util::map_keys_iterator<const_iterator,string,const string&,const string*>(begin(),end());
181 } 181 }
182 openid_message_t::fields_iterator openid_message_t::fields_end() const { 182 openid_message_t::fields_iterator openid_message_t::fields_end() const {
183 return util::map_keys_iterator<const_iterator,string,const string&,const string*>(end(),end()); 183 return util::map_keys_iterator<const_iterator,string,const string&,const string*>(end(),end());
184 } 184 }
185 185