AU: Expose the server's HTTP response code in HttpFetcher.
A step towards resolving 2394 -- we'll need to exponentially back
off on 500 and 503 as well as 502 if possible.
BUG=2394
TEST=unit tests, gmerged and made sure updates can happen
Change-Id: I7928e3af37f23ce1ba197315ec52ab0b2ed0dc4c
Review URL: http://codereview.chromium.org/3106038
diff --git a/http_fetcher.h b/http_fetcher.h
index 5cd6f08..f8e510a 100644
--- a/http_fetcher.h
+++ b/http_fetcher.h
@@ -23,14 +23,15 @@
class HttpFetcher {
public:
- HttpFetcher() : post_data_set_(false), delegate_(NULL) {}
+ HttpFetcher()
+ : post_data_set_(false),
+ http_response_code_(0),
+ delegate_(NULL) {}
virtual ~HttpFetcher() {}
- void set_delegate(HttpFetcherDelegate* delegate) {
- delegate_ = delegate;
- }
- HttpFetcherDelegate* delegate() const {
- return delegate_;
- }
+
+ void set_delegate(HttpFetcherDelegate* delegate) { delegate_ = delegate; }
+ HttpFetcherDelegate* delegate() const { return delegate_; }
+ int http_response_code() const { return http_response_code_; }
// Optional: Post data to the server. The HttpFetcher should make a copy
// of this data and upload it via HTTP POST during the transfer.
@@ -66,6 +67,11 @@
bool post_data_set_;
std::vector<char> post_data_;
+ // The server's HTTP response code from the last transfer. This
+ // field should be set to 0 when a new transfer is initiated, and
+ // set to the response code when the transfer is complete.
+ int http_response_code_;
+
// The delegate; may be NULL.
HttpFetcherDelegate* delegate_;
private: