| Index: components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
|
| diff --git a/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc b/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
|
| index ab3844578dc3a053f4d91d70b65ed985d800ec9d..b691faf0b538ca80680385d7c864e1e4b942d37e 100644
|
| --- a/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
|
| +++ b/components/data_reduction_proxy/core/common/data_reduction_proxy_util.cc
|
| @@ -16,20 +16,22 @@
|
| namespace data_reduction_proxy {
|
|
|
| namespace {
|
|
|
| #if defined(USE_GOOGLE_API_KEYS)
|
| // Used in all Data Reduction Proxy URLs to specify API Key.
|
| const char kApiKeyName[] = "key";
|
| #endif
|
| } // namespace
|
|
|
| +namespace util {
|
| +
|
| bool IsMethodIdempotent(const std::string& method) {
|
| return method == "GET" || method == "OPTIONS" || method == "HEAD" ||
|
| method == "PUT" || method == "DELETE" || method == "TRACE";
|
| }
|
|
|
| GURL AddApiKeyToUrl(const GURL& url) {
|
| GURL new_url = url;
|
| #if defined(USE_GOOGLE_API_KEYS)
|
| std::string api_key = google_apis::GetAPIKey();
|
| if (google_apis::HasKeysConfigured() && !api_key.empty()) {
|
| @@ -51,20 +53,22 @@ bool ApplyProxyConfigToProxyInfo(const net::ProxyConfig& proxy_config,
|
| const GURL& url,
|
| net::ProxyInfo* data_reduction_proxy_info) {
|
| DCHECK(data_reduction_proxy_info);
|
| if (!proxy_config.is_valid())
|
| return false;
|
| proxy_config.proxy_rules().Apply(url, data_reduction_proxy_info);
|
| data_reduction_proxy_info->DeprioritizeBadProxies(proxy_retry_info);
|
| return !data_reduction_proxy_info->proxy_server().is_direct();
|
| }
|
|
|
| +} // namespace util
|
| +
|
| namespace protobuf_parser {
|
|
|
| net::ProxyServer::Scheme SchemeFromProxyScheme(
|
| ProxyServer_ProxyScheme proxy_scheme) {
|
| switch (proxy_scheme) {
|
| case ProxyServer_ProxyScheme_HTTP:
|
| return net::ProxyServer::SCHEME_HTTP;
|
| case ProxyServer_ProxyScheme_HTTPS:
|
| return net::ProxyServer::SCHEME_HTTPS;
|
| case ProxyServer_ProxyScheme_QUIC:
|
|
|