Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include/AdblockPlus/WebRequest.h

Issue 10252013: Implemented curl support for web requests (Closed)
Patch Set: Addressed review comments Created April 12, 2013, 1:37 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « check_curl.py ('k') | libadblockplus.gyp » ('j') | test/WebRequest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/WebRequest.h
===================================================================
--- a/include/AdblockPlus/WebRequest.h
+++ b/include/AdblockPlus/WebRequest.h
@@ -1,48 +1,48 @@
#ifndef ADBLOCKPLUS_WEB_REQUEST_H
#define ADBLOCKPLUS_WEB_REQUEST_H
#include <string>
#include <vector>
-enum
-{
- NS_OK = 0,
- NS_ERROR_FAILURE = 0x80004005,
- NS_ERROR_OUT_OF_MEMORY = 0x8007000e,
- NS_ERROR_MALFORMED_URI = 0x804b000a,
- NS_ERROR_CONNECTION_REFUSED = 0x804b000d,
- NS_ERROR_NET_TIMEOUT = 0x804b000e,
- NS_ERROR_NO_CONTENT = 0x804b0011,
- NS_ERROR_UNKNOWN_PROTOCOL = 0x804b0012,
- NS_ERROR_NET_RESET = 0x804b0014,
- NS_ERROR_UNKNOWN_HOST = 0x804b001e,
- NS_ERROR_REDIRECT_LOOP = 0x804b001f,
- NS_ERROR_UNKNOWN_PROXY_HOST = 0x804b002a,
- NS_ERROR_NOT_INITIALIZED = 0xc1f30001,
- NS_CUSTOM_ERROR_BASE = 0x80850000
-};
-
namespace AdblockPlus
{
typedef std::vector<std::pair<std::string, std::string> > HeaderList;
struct ServerResponse
{
unsigned int status;
HeaderList responseHeaders;
int responseStatus;
std::string responseText;
};
class WebRequest
{
public:
- virtual ~WebRequest();
+ enum
+ {
+ NS_OK = 0,
+ NS_ERROR_FAILURE = 0x80004005,
+ NS_ERROR_OUT_OF_MEMORY = 0x8007000e,
+ NS_ERROR_MALFORMED_URI = 0x804b000a,
+ NS_ERROR_CONNECTION_REFUSED = 0x804b000d,
+ NS_ERROR_NET_TIMEOUT = 0x804b000e,
+ NS_ERROR_NO_CONTENT = 0x804b0011,
+ NS_ERROR_UNKNOWN_PROTOCOL = 0x804b0012,
+ NS_ERROR_NET_RESET = 0x804b0014,
+ NS_ERROR_UNKNOWN_HOST = 0x804b001e,
+ NS_ERROR_REDIRECT_LOOP = 0x804b001f,
+ NS_ERROR_UNKNOWN_PROXY_HOST = 0x804b002a,
+ NS_ERROR_NOT_INITIALIZED = 0xc1f30001,
+ NS_CUSTOM_ERROR_BASE = 0x80850000
+ };
+
+ virtual inline ~WebRequest() {};
Felix Dahlke 2013/04/16 12:21:09 Oh, just noticed, inline is actually not necessary
Wladimir Palant 2013/04/16 13:30:32 Let's remove it everywhere then later, not only in
Felix Dahlke 2013/04/16 14:51:37 Okay.
virtual ServerResponse GET(const std::string& url, const HeaderList& requestHeaders) const = 0;
};
class DefaultWebRequest : public WebRequest
{
Oleksandr 2013/04/16 12:02:01 I don't quite understand the logic behind this nam
Felix Dahlke 2013/04/16 12:21:09 Yeah, most likely. We cannot really use curl on An
Oleksandr 2013/04/16 12:26:18 Let me rephrase my question: why do all implementa
Wladimir Palant 2013/04/16 13:30:32 The thinking behind this: 1) We have clear prefer
ServerResponse GET(const std::string& url, const HeaderList& requestHeaders) const;
};
}
« no previous file with comments | « check_curl.py ('k') | libadblockplus.gyp » ('j') | test/WebRequest.cpp » ('J')

Powered by Google App Engine
This is Rietveld