]> git.tdb.fi Git - libs/net.git/blobdiff - source/http/utils.h
Prepare for assimilation into mspnet
[libs/net.git] / source / http / utils.h
diff --git a/source/http/utils.h b/source/http/utils.h
new file mode 100644 (file)
index 0000000..a25a748
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef MSP_HTTP_UTILS_H_
+#define MSP_HTTP_UTILS_H_
+
+#include <map>
+#include <string>
+
+namespace Msp {
+namespace Http {
+
+enum EncodeLevel
+{
+       MINIMAL,
+       SAFE,
+       PARANOID
+};
+
+struct Url
+{
+       std::string scheme;
+       std::string host;
+       std::string path;
+       std::string query;
+       std::string fragment;
+};
+
+typedef std::map<std::string, std::string> Query;
+
+std::string urlencode(const std::string &, EncodeLevel =SAFE);
+std::string urlencode_plus(const std::string &, EncodeLevel =SAFE);
+std::string urldecode(const std::string &);
+Url parse_url(const std::string &);
+std::string build_url(const Url &);
+Query parse_query(const std::string &);
+std::string build_query(const Query &);
+
+} // namespace Http
+} // namespace Msp
+
+#endif