00001 // ZenLib::Format::Http::Utils - Utils for HTTP handling 00002 // Copyright (C) 2008-2011 MediaArea.net SARL, Info@MediaArea.net 00003 // 00004 // This software is provided 'as-is', without any express or implied 00005 // warranty. In no event will the authors be held liable for any damages 00006 // arising from the use of this software. 00007 // 00008 // Permission is granted to anyone to use this software for any purpose, 00009 // including commercial applications, and to alter it and redistribute it 00010 // freely, subject to the following restrictions: 00011 // 00012 // 1. The origin of this software must not be misrepresented; you must not 00013 // claim that you wrote the original software. If you use this software 00014 // in a product, an acknowledgment in the product documentation would be 00015 // appreciated but is not required. 00016 // 2. Altered source versions must be plainly marked as such, and must not be 00017 // misrepresented as being the original software. 00018 // 3. This notice may not be removed or altered from any source distribution. 00019 // 00020 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00021 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00022 // 00023 // HTTP utils 00024 // 00025 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 00026 00027 //--------------------------------------------------------------------------- 00028 #ifndef ZenLib_Server_Http_UtilsH 00029 #define ZenLib_Server_Http_UtilsH 00030 //--------------------------------------------------------------------------- 00031 00032 //--------------------------------------------------------------------------- 00033 #include <string> 00034 #include <ctime> 00035 #include <map> 00036 #include <vector> 00037 //--------------------------------------------------------------------------- 00038 00039 namespace ZenLib 00040 { 00041 00042 namespace Format 00043 { 00044 00045 namespace Http 00046 { 00047 00048 //*************************************************************************** 00049 // 00050 //*************************************************************************** 00051 00052 //--------------------------------------------------------------------------- 00053 // Character manipulation 00054 unsigned char Char2Hex (unsigned char Char); 00055 wchar_t Char2Hex (wchar_t Char); 00056 std::string Hex2Char (unsigned char Char); 00057 std::wstring Hex2Char (wchar_t Char); 00058 00059 //--------------------------------------------------------------------------- 00060 // URL manipulation 00061 std::string URL_Encoded_Encode (const std::string& URL); 00062 std::wstring URL_Encoded_Encode (const std::wstring& URL); 00063 std::string URL_Encoded_Decode (const std::string& URL); 00064 std::wstring URL_Encoded_Decode (const std::wstring& URL); 00065 00066 //--------------------------------------------------------------------------- 00067 // Cleanup 00068 void TrimLeft (std::string& String, char ToTrim); 00069 00070 } //Namespace 00071 00072 } //Namespace 00073 00074 } //Namespace 00075 00076 #endif //ZENLIB_SERVER_HTTP_UTILS 00077 00078 00079 00080