summaryrefslogtreecommitdiffabout
path: root/include
authorMichael Krelin <hacker@klever.net>2007-11-23 22:18:54 (UTC)
committer Michael Krelin <hacker@klever.net>2007-11-24 07:09:40 (UTC)
commit70f85314fcd188a182aae3a4291c0cd95ba16ee2 (patch) (unidiff)
treecad4bf188542d4319280a3c30757e72ec2d20bf6 /include
parent2589c69c4a909563098365fba141082db4657353 (diff)
downloadlibopkele-70f85314fcd188a182aae3a4291c0cd95ba16ee2.zip
libopkele-70f85314fcd188a182aae3a4291c0cd95ba16ee2.tar.gz
libopkele-70f85314fcd188a182aae3a4291c0cd95ba16ee2.tar.bz2
added URI normalization procedure to opkele::util
as specified in RFC3896, section 6 Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
-rw-r--r--include/opkele/util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/opkele/util.h b/include/opkele/util.h
index edc1859..085c9e6 100644
--- a/include/opkele/util.h
+++ b/include/opkele/util.h
@@ -81,53 +81,63 @@ namespace opkele {
81 * @return w3c time 81 * @return w3c time
82 * @throw failed_conversion in case of error 82 * @throw failed_conversion in case of error
83 */ 83 */
84 string time_to_w3c(time_t t); 84 string time_to_w3c(time_t t);
85 /** 85 /**
86 * Convert W3C time representation to internal time_t 86 * Convert W3C time representation to internal time_t
87 * @param w w3c representation 87 * @param w w3c representation
88 * @return converted time 88 * @return converted time
89 * @throw failed_conversion in case of error 89 * @throw failed_conversion in case of error
90 */ 90 */
91 time_t w3c_to_time(const string& w); 91 time_t w3c_to_time(const string& w);
92 92
93 /** 93 /**
94 * Encode string to the representation suitable for using in URL. 94 * Encode string to the representation suitable for using in URL.
95 * @param str string to encode 95 * @param str string to encode
96 * @return encoded string 96 * @return encoded string
97 * @throw failed_conversion in case of failure 97 * @throw failed_conversion in case of failure
98 */ 98 */
99 string url_encode(const string& str); 99 string url_encode(const string& str);
100 100
101 /** 101 /**
102 * Convert number to string 102 * Convert number to string
103 * @param l number 103 * @param l number
104 * @return string representation 104 * @return string representation
105 * @throw failed_conversion in case of failure 105 * @throw failed_conversion in case of failure
106 */ 106 */
107 string long_to_string(long l); 107 string long_to_string(long l);
108 /** 108 /**
109 * Convert string to number 109 * Convert string to number
110 * @param s string, containing the number 110 * @param s string, containing the number
111 * @return the number 111 * @return the number
112 * @throw failed_conversion in case of failure 112 * @throw failed_conversion in case of failure
113 */ 113 */
114 long string_to_long(const string& s); 114 long string_to_long(const string& s);
115 115
116 /** 116 /**
117 * Encode binary data using base64. 117 * Encode binary data using base64.
118 * @param data pointer to binary data 118 * @param data pointer to binary data
119 * @param length length of data 119 * @param length length of data
120 * @return encoded data 120 * @return encoded data
121 */ 121 */
122 string encode_base64(const void *data,size_t length); 122 string encode_base64(const void *data,size_t length);
123 /** 123 /**
124 * Decode binary data from base64 representation. 124 * Decode binary data from base64 representation.
125 * @param data base64-encoded data 125 * @param data base64-encoded data
126 * @param rv container for decoded binary 126 * @param rv container for decoded binary
127 */ 127 */
128 void decode_base64(const string& data,vector<unsigned char>& rv); 128 void decode_base64(const string& data,vector<unsigned char>& rv);
129
130 /**
131 * Normalize http(s) URI according to RFC3986, section 6. URI is
132 * expected to have scheme: in front of it.
133 * @param uri URI
134 * @return normalized URI
135 * @throw not_implemented in case of non-httpi(s) URI
136 * @throw bad_input in case of malformed URI
137 */
138 string rfc_3986_normalize_uri(const string& uri);
129 } 139 }
130 140
131} 141}
132 142
133#endif /* __OPKELE_UTIL_H */ 143#endif /* __OPKELE_UTIL_H */