Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Unified Diff: http_fetcher.h

Issue 5205002: AU: Manual proxy support (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: missed one fix for review Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « filesystem_copier_action_unittest.cc ('k') | http_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: http_fetcher.h
diff --git a/http_fetcher.h b/http_fetcher.h
index 6d8608b62996f72d7d198983917471f360dc3913..a50c760f35aa519f27b0986193c148b8fc3a33bd 100644
--- a/http_fetcher.h
+++ b/http_fetcher.h
@@ -5,10 +5,15 @@
#ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__
#define CHROMEOS_PLATFORM_UPDATE_ENGINE_HTTP_FETCHER_H__
+#include <deque>
#include <string>
#include <vector>
+
+#include <base/basictypes.h>
+#include <base/logging.h>
#include <glib.h>
-#include "base/basictypes.h"
+
+#include "update_engine/proxy_resolver.h"
// This class is a simple wrapper around an HTTP library (libcurl). We can
// easily mock out this interface for testing.
@@ -23,10 +28,15 @@ class HttpFetcherDelegate;
class HttpFetcher {
public:
- HttpFetcher()
+ // |proxy_resolver| is the resolver that will be consulted for proxy
+ // settings. It may be null, in which case direct connections will
+ // be used. Does not take ownership of the resolver.
+ explicit HttpFetcher(ProxyResolver* proxy_resolver)
: post_data_set_(false),
http_response_code_(0),
- delegate_(NULL) {}
+ delegate_(NULL),
+ proxies_(1, kNoProxy),
+ proxy_resolver_(proxy_resolver) {}
virtual ~HttpFetcher() {}
void set_delegate(HttpFetcherDelegate* delegate) { delegate_ = delegate; }
@@ -35,12 +45,19 @@ class HttpFetcher {
// Optional: Post data to the server. The HttpFetcher should make a copy
// of this data and upload it via HTTP POST during the transfer.
- void SetPostData(const void* data, size_t size) {
- post_data_set_ = true;
- post_data_.clear();
- const char *char_data = reinterpret_cast<const char*>(data);
- post_data_.insert(post_data_.end(), char_data, char_data + size);
+ void SetPostData(const void* data, size_t size);
+
+ // Proxy methods to set the proxies, then to pop them off.
+ void ResolveProxiesForUrl(const std::string& url);
+
+ void SetProxies(const std::deque<std::string>& proxies) {
+ proxies_ = proxies;
}
+ const std::string& GetCurrentProxy() const {
+ return proxies_.front();
+ }
+ bool HasProxy() const { return !proxies_.empty(); }
+ void PopProxy() { proxies_.pop_front(); }
// Downloading should resume from this offset
virtual void SetOffset(off_t offset) = 0;
@@ -84,6 +101,12 @@ class HttpFetcher {
// The delegate; may be NULL.
HttpFetcherDelegate* delegate_;
+
+ // Proxy servers
+ std::deque<std::string> proxies_;
+
+ ProxyResolver* const proxy_resolver_;
+
private:
DISALLOW_COPY_AND_ASSIGN(HttpFetcher);
};
« no previous file with comments | « filesystem_copier_action_unittest.cc ('k') | http_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698