X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Futils.h;h=a25a748a6aa7464409c20fb1c67702b9b3e367a1;hb=c8df43e7794dc82d5604dfa612e464bbc5ca3cdd;hp=76127a4525845562841c4084d14557f8e948c021;hpb=077408f98f08fac1a098a501fffdb22728a57a46;p=libs%2Fnet.git diff --git a/source/utils.h b/source/utils.h index 76127a4..a25a748 100644 --- a/source/utils.h +++ b/source/utils.h @@ -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 #include 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 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