| Index: components/update_client/request_sender.h
|
| diff --git a/components/update_client/request_sender.h b/components/update_client/request_sender.h
|
| index 71b41ee538dc56f4d92b74fff9e0a5dc620d1e05..fc511f2a2a378b63408498d0729bc6451d3630ff 100644
|
| --- a/components/update_client/request_sender.h
|
| +++ b/components/update_client/request_sender.h
|
| @@ -5,6 +5,8 @@
|
| #ifndef COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_
|
| #define COMPONENTS_UPDATE_CLIENT_REQUEST_SENDER_H_
|
|
|
| +#include <stdint.h>
|
| +
|
| #include <string>
|
| #include <vector>
|
|
|
| @@ -32,8 +34,12 @@ class Configurator;
|
| class RequestSender : public net::URLFetcherDelegate {
|
| public:
|
| // If |error| is 0, then the response is provided in the |response| parameter.
|
| - using RequestSenderCallback =
|
| - base::Callback<void(int error, const std::string& response)>;
|
| + // |retry_after_sec| contains the value of the X-Retry-After response header,
|
| + // when the response was received from a cryptografically secure URL. The
|
| + // range for this value is [0, 86400], where the upper bound represents one
|
| + // day, and 0 means that no retry policy should be in effect.
|
| + using RequestSenderCallback = base::Callback<
|
| + void(int error, const std::string& response, int retry_after_sec)>;
|
|
|
| static int kErrorResponseNotTrusted;
|
|
|
| @@ -54,9 +60,15 @@ class RequestSender : public net::URLFetcherDelegate {
|
| // Decodes and returns the public key used by CUP.
|
| static std::string GetKey(const char* key_bytes_base64);
|
|
|
| - // Returns the Etag of the server response or an empty string if the
|
| - // Etag is not available.
|
| - static std::string GetServerETag(const net::URLFetcher* source);
|
| + // Returns the string value of a header of the server response or an empty
|
| + // string if the header is not available.
|
| + static std::string GetStringHeaderValue(const net::URLFetcher* source,
|
| + const char* header_name);
|
| +
|
| + // Returns the integral value of a header of the server response or -1 if
|
| + // if the header is not available or a conversion error has occured.
|
| + static int64_t GetInt64HeaderValue(const net::URLFetcher* source,
|
| + const char* header_name);
|
|
|
| // Overrides for URLFetcherDelegate.
|
| void OnURLFetchComplete(const net::URLFetcher* source) override;
|
| @@ -68,10 +80,11 @@ class RequestSender : public net::URLFetcherDelegate {
|
| // contain the body and the etag associated with the HTTP response.
|
| void SendInternalComplete(int error,
|
| const std::string& response_body,
|
| - const std::string& response_etag);
|
| + const std::string& response_etag,
|
| + int retry_after_sec);
|
|
|
| // Helper function to handle a non-continuable error in Send.
|
| - void HandleSendError(int error);
|
| + void HandleSendError(int error, int retry_after_sec);
|
|
|
| base::ThreadChecker thread_checker_;
|
|
|
|
|