]> git.tdb.fi Git - libs/net.git/blobdiff - source/utils.h
Use maputils.h
[libs/net.git] / source / utils.h
index 76127a4525845562841c4084d14557f8e948c021..a25a748a6aa7464409c20fb1c67702b9b3e367a1 100644 (file)
@@ -1,20 +1,37 @@
-/* $Id$
-
-This file is part of libmsphttp
-Copyright © 2009  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_HTTP_UTILS_H_
 #define MSP_HTTP_UTILS_H_
 
+#include <map>
 #include <string>
 
 namespace Msp {
 namespace Http {
 
-std::string urlencode(const std::string &);
+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