Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 20 matching lines...) Expand all Loading... | |
31 */ | 31 */ |
32 typedef std::vector<std::pair<std::string, std::string> > HeaderList; | 32 typedef std::vector<std::pair<std::string, std::string> > HeaderList; |
33 | 33 |
34 /** | 34 /** |
35 * HTTP response. | 35 * HTTP response. |
36 */ | 36 */ |
37 struct ServerResponse | 37 struct ServerResponse |
38 { | 38 { |
39 //@{ | 39 //@{ |
40 /** | 40 /** |
41 * Status code of the response. | 41 * [Mozilla status code](https://developer.mozilla.org/en/docs/Table_Of_Erro rs#Network_Errors) |
Wladimir Palant
2014/08/29 18:42:27
[Mozilla status code](https://developer.mozilla.or
Felix Dahlke
2014/09/01 17:00:15
Done.
| |
42 * indicating the network-level request status. | |
43 * This should be 0 (NS_OK) if the request succeeded. Note that this should | |
44 * be NS_OK if the server responded with an error code like "404 Not Found". | |
42 */ | 45 */ |
43 #ifdef _WIN32 | 46 #ifdef _WIN32 |
44 __int64 status; | 47 __int64 status; |
45 #else | 48 #else |
46 int64_t status; | 49 int64_t status; |
47 #endif | 50 #endif |
48 //@} | 51 //@} |
49 | 52 |
50 /** | 53 /** |
51 * List of response headers. | 54 * List of response headers. |
52 */ | 55 */ |
53 HeaderList responseHeaders; | 56 HeaderList responseHeaders; |
54 | 57 |
55 /** | 58 /** |
56 * HTTP status of the response. | 59 * HTTP status of the response (e.g.\ 404). |
Wladimir Palant
2014/08/29 18:42:27
" like 200 or 404"?
Felix Dahlke
2014/09/01 17:00:15
Done.
| |
57 */ | 60 */ |
58 int responseStatus; | 61 int responseStatus; |
59 | 62 |
60 /** | 63 /** |
61 * Body text of the response. | 64 * Body text of the response. |
62 */ | 65 */ |
63 std::string responseText; | 66 std::string responseText; |
64 }; | 67 }; |
65 | 68 |
66 /** | 69 /** |
67 * Web request interface. | 70 * Web request interface. |
68 */ | 71 */ |
69 class WebRequest | 72 class WebRequest |
70 { | 73 { |
71 public: | 74 public: |
72 /** | 75 /** |
73 * Possible response status codes. | 76 * Possible [Mozilla status codes](https://developer.mozilla.org/en/docs/Tab le_Of_Errors#Network_Errors). |
74 */ | 77 */ |
75 enum | 78 enum |
76 { | 79 { |
77 NS_OK = 0, | 80 NS_OK = 0, |
78 NS_ERROR_FAILURE = 0x80004005, | 81 NS_ERROR_FAILURE = 0x80004005, |
79 NS_ERROR_OUT_OF_MEMORY = 0x8007000e, | 82 NS_ERROR_OUT_OF_MEMORY = 0x8007000e, |
80 NS_ERROR_MALFORMED_URI = 0x804b000a, | 83 NS_ERROR_MALFORMED_URI = 0x804b000a, |
81 NS_ERROR_CONNECTION_REFUSED = 0x804b000d, | 84 NS_ERROR_CONNECTION_REFUSED = 0x804b000d, |
82 NS_ERROR_NET_TIMEOUT = 0x804b000e, | 85 NS_ERROR_NET_TIMEOUT = 0x804b000e, |
83 NS_ERROR_NO_CONTENT = 0x804b0011, | 86 NS_ERROR_NO_CONTENT = 0x804b0011, |
(...skipping 19 matching lines...) Expand all Loading... | |
103 virtual ServerResponse GET(const std::string& url, const HeaderList& request Headers) const = 0; | 106 virtual ServerResponse GET(const std::string& url, const HeaderList& request Headers) const = 0; |
104 }; | 107 }; |
105 | 108 |
106 /** | 109 /** |
107 * Shared smart pointer to a `WebRequest` instance. | 110 * Shared smart pointer to a `WebRequest` instance. |
108 */ | 111 */ |
109 typedef std::tr1::shared_ptr<WebRequest> WebRequestPtr; | 112 typedef std::tr1::shared_ptr<WebRequest> WebRequestPtr; |
110 } | 113 } |
111 | 114 |
112 #endif | 115 #endif |
LEFT | RIGHT |