123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include <map>
- #include <vector>
- #include <string>
- #if (defined(__clang__) && defined(_LIBCPP_VERSION)) || (__cplusplus >= 201103L)
- #include <memory>
- #else
- #include <tr1/memory>
- #endif
- #include <curl/curl.h>
- #ifdef USE_LUA
- #include <lua.hpp>
- #endif
- class BBS2chProxyHttpHeaderEntry {
- private:
- std::string _name;
- std::vector<std::string> _values;
- public:
- BBS2chProxyHttpHeaderEntry(const std::string &name, const std::string &value)
- {
- _name = name;
- _values.push_back(value);
- }
- std::string& getName(void);
- std::string getValue(void);
- std::string getFull(void);
- std::vector<std::string>& getValueList(void);
- void add(const std::string &value);
- void set(const std::string &value);
- };
- #if (defined(__clang__) && defined(_LIBCPP_VERSION)) || (__cplusplus >= 201103L)
- typedef std::shared_ptr<BBS2chProxyHttpHeaderEntry> PBBS2chProxyHttpHeaderEntry;
- #else
- typedef std::tr1::shared_ptr<BBS2chProxyHttpHeaderEntry> PBBS2chProxyHttpHeaderEntry;
- #endif
- class BBS2chProxyHttpHeaders {
- private:
- std::map<std::string, PBBS2chProxyHttpHeaderEntry> _headers;
- public:
- std::string get(const std::string &name);
- bool has(const std::string &name);
- void add(const std::string &name, const std::string &value);
- void add(const char *field);
- void set(const std::string &name, const std::string &value);
- void remove(const std::string &name);
- void clear(void);
- curl_slist* appendToCurlSlist(curl_slist *list);
- curl_slist* appendToCurlSlist(curl_slist *list, const std::string &name);
- std::map<std::string, PBBS2chProxyHttpHeaderEntry>& getMap(void);
- #ifdef USE_LUA
- static void getObjectMetatableForLua(lua_State *l);
- static void getClassDefinitionForLua(lua_State *l);
- void getUserdataForLua(lua_State *l);
- #endif
- };
|