summaryrefslogtreecommitdiffabout
path: root/include
authorMichael Krelin <hacker@klever.net>2008-02-02 21:10:12 (UTC)
committer Michael Krelin <hacker@klever.net>2008-02-02 21:10:12 (UTC)
commit3658759966cbadb7b50457d446f3436b6f7987da (patch) (unidiff)
treeb215da5b5212b60aa1ec965df28070b4bff587bc /include
parenta8f733c88d87abe422ecaa405df385bad562e60f (diff)
downloadlibopkele-3658759966cbadb7b50457d446f3436b6f7987da.zip
libopkele-3658759966cbadb7b50457d446f3436b6f7987da.tar.gz
libopkele-3658759966cbadb7b50457d446f3436b6f7987da.tar.bz2
moved uri matching into separate procedure
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'include') (more/less context) (show whitespace changes)
-rw-r--r--include/opkele/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/opkele/util.h b/include/opkele/util.h
index 719f951..bc1a0ea 100644
--- a/include/opkele/util.h
+++ b/include/opkele/util.h
@@ -124,48 +124,56 @@ namespace opkele {
124 /** 124 /**
125 * Encode binary data using base64. 125 * Encode binary data using base64.
126 * @param data pointer to binary data 126 * @param data pointer to binary data
127 * @param length length of data 127 * @param length length of data
128 * @return encoded data 128 * @return encoded data
129 */ 129 */
130 string encode_base64(const void *data,size_t length); 130 string encode_base64(const void *data,size_t length);
131 /** 131 /**
132 * Decode binary data from base64 representation. 132 * Decode binary data from base64 representation.
133 * @param data base64-encoded data 133 * @param data base64-encoded data
134 * @param rv container for decoded binary 134 * @param rv container for decoded binary
135 */ 135 */
136 void decode_base64(const string& data,vector<unsigned char>& rv); 136 void decode_base64(const string& data,vector<unsigned char>& rv);
137 137
138 /** 138 /**
139 * Normalize http(s) URI according to RFC3986, section 6. URI is 139 * Normalize http(s) URI according to RFC3986, section 6. URI is
140 * expected to have scheme: in front of it. 140 * expected to have scheme: in front of it.
141 * @param uri URI 141 * @param uri URI
142 * @return normalized URI 142 * @return normalized URI
143 * @throw not_implemented in case of non-httpi(s) URI 143 * @throw not_implemented in case of non-httpi(s) URI
144 * @throw bad_input in case of malformed URI 144 * @throw bad_input in case of malformed URI
145 */ 145 */
146 string rfc_3986_normalize_uri(const string& uri); 146 string rfc_3986_normalize_uri(const string& uri);
147 147
148 /**
149 * Match URI against realm
150 * @param uri URI to match
151 * @param realm realm to match against
152 * @return true if URI matches realm
153 */
154 bool uri_matches_realm(const string& uri,const string& realm);
155
148 string& strip_uri_fragment_part(string& uri); 156 string& strip_uri_fragment_part(string& uri);
149 157
150 string abi_demangle(const char* mn); 158 string abi_demangle(const char* mn);
151 159
152 string base64_signature(const assoc_t& assoc,const basic_openid_message& om); 160 string base64_signature(const assoc_t& assoc,const basic_openid_message& om);
153 161
154 class change_mode_message_proxy : public basic_openid_message { 162 class change_mode_message_proxy : public basic_openid_message {
155 public: 163 public:
156 const basic_openid_message& x; 164 const basic_openid_message& x;
157 const string& mode; 165 const string& mode;
158 166
159 change_mode_message_proxy(const basic_openid_message& xx,const string& m) : x(xx), mode(m) { } 167 change_mode_message_proxy(const basic_openid_message& xx,const string& m) : x(xx), mode(m) { }
160 168
161 bool has_field(const string& n) const { return x.has_field(n); } 169 bool has_field(const string& n) const { return x.has_field(n); }
162 const string& get_field(const string& n) const { 170 const string& get_field(const string& n) const {
163 return (n=="mode")?mode:x.get_field(n); } 171 return (n=="mode")?mode:x.get_field(n); }
164 bool has_ns(const string& uri) const {return x.has_ns(uri); } 172 bool has_ns(const string& uri) const {return x.has_ns(uri); }
165 string get_ns(const string& uri) const { return x.get_ns(uri); } 173 string get_ns(const string& uri) const { return x.get_ns(uri); }
166 fields_iterator fields_begin() const { 174 fields_iterator fields_begin() const {
167 return x.fields_begin(); } 175 return x.fields_begin(); }
168 fields_iterator fields_end() const { 176 fields_iterator fields_end() const {
169 return x.fields_end(); } 177 return x.fields_end(); }
170 }; 178 };
171 179