-rw-r--r-- | lib/message.cc | 2 |
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 | |||
@@ -145,33 +145,33 @@ namespace opkele { | |||
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 | } |