]> git.tdb.fi Git - libs/net.git/blob - source/http/utils.h
Add a dynamic receiver class for more flexible packet handling
[libs/net.git] / source / http / utils.h
1 #ifndef MSP_HTTP_UTILS_H_
2 #define MSP_HTTP_UTILS_H_
3
4 #include <map>
5 #include <string>
6 #include <msp/net/mspnet_api.h>
7
8 namespace Msp {
9 namespace Http {
10
11 enum EncodeLevel
12 {
13         MINIMAL,
14         SAFE,
15         PARANOID
16 };
17
18 struct Url
19 {
20         std::string scheme;
21         std::string host;
22         std::string path;
23         std::string query;
24         std::string fragment;
25 };
26
27 typedef std::map<std::string, std::string> Query;
28
29 MSPNET_API std::string urlencode(const std::string &, EncodeLevel =SAFE);
30 MSPNET_API std::string urlencode_plus(const std::string &, EncodeLevel =SAFE);
31 MSPNET_API std::string urldecode(const std::string &);
32 MSPNET_API Url parse_url(const std::string &);
33 MSPNET_API std::string build_url(const Url &);
34 MSPNET_API Query parse_query(const std::string &);
35 MSPNET_API std::string build_query(const Query &);
36
37 } // namespace Http
38 } // namespace Msp
39
40 #endif