OLD | NEW |
1 #ifndef ADBLOCKPLUS_WEB_REQUEST_H | 1 #ifndef ADBLOCKPLUS_WEB_REQUEST_H |
2 #define ADBLOCKPLUS_WEB_REQUEST_H | 2 #define ADBLOCKPLUS_WEB_REQUEST_H |
3 | 3 |
4 #include <string> | 4 #include <string> |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
| 7 enum |
| 8 { |
| 9 NS_OK = 0, |
| 10 NS_ERROR_FAILURE = 0x80004005, |
| 11 NS_ERROR_OUT_OF_MEMORY = 0x8007000e, |
| 12 NS_ERROR_MALFORMED_URI = 0x804b000a, |
| 13 NS_ERROR_CONNECTION_REFUSED = 0x804b000d, |
| 14 NS_ERROR_NET_TIMEOUT = 0x804b000e, |
| 15 NS_ERROR_NO_CONTENT = 0x804b0011, |
| 16 NS_ERROR_UNKNOWN_PROTOCOL = 0x804b0012, |
| 17 NS_ERROR_NET_RESET = 0x804b0014, |
| 18 NS_ERROR_UNKNOWN_HOST = 0x804b001e, |
| 19 NS_ERROR_REDIRECT_LOOP = 0x804b001f, |
| 20 NS_ERROR_UNKNOWN_PROXY_HOST = 0x804b002a, |
| 21 NS_ERROR_NOT_INITIALIZED = 0xc1f30001, |
| 22 NS_CUSTOM_ERROR_BASE = 0x80850000 |
| 23 }; |
| 24 |
7 namespace AdblockPlus | 25 namespace AdblockPlus |
8 { | 26 { |
9 typedef std::vector< std::pair<std::string, std::string> > HeadersList; | 27 typedef std::vector< std::pair<std::string, std::string> > HeadersList; |
10 | 28 |
11 struct ServerResponse | 29 struct ServerResponse |
12 { | 30 { |
| 31 unsigned int status; |
13 HeadersList responseHeaders; | 32 HeadersList responseHeaders; |
14 int responseStatus; | 33 int responseStatus; |
15 std::string responseText; | 34 std::string responseText; |
16 }; | 35 }; |
17 | 36 |
18 class WebRequest | 37 class WebRequest |
19 { | 38 { |
20 public: | 39 public: |
21 virtual ~WebRequest(); | 40 virtual ~WebRequest(); |
22 virtual ServerResponse GET(const std::string& url, const HeadersList& reques
tHeaders) const = 0; | 41 virtual ServerResponse GET(const std::string& url, const HeadersList& reques
tHeaders) const = 0; |
23 }; | 42 }; |
| 43 |
| 44 class DefaultWebRequest : public WebRequest |
| 45 { |
| 46 ServerResponse GET(const std::string& url, const HeadersList& requestHeaders
) const; |
| 47 }; |
24 } | 48 } |
25 | 49 |
26 #endif | 50 #endif |
OLD | NEW |