| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/update_client/request_sender.h" | 5 #include "components/update_client/request_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "components/client_update_protocol/ecdsa.h" | 17 #include "components/client_update_protocol/ecdsa.h" |
| 18 #include "components/update_client/configurator.h" | 18 #include "components/update_client/configurator.h" |
| 19 #include "components/update_client/utils.h" | 19 #include "components/update_client/utils.h" |
| 20 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
| 21 #include "net/url_request/url_fetcher.h" | 21 #include "net/url_request/url_fetcher.h" |
| 22 #include "net/url_request/url_request_status.h" | 22 #include "net/url_request/url_request_status.h" |
| 23 | 23 |
| 24 namespace update_client { | 24 namespace update_client { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 // This is an ECDSA prime256v1 named-curve key. | 28 // This is an ECDSA prime256v1 named-curve key. |
| 29 const int kKeyVersion = 7; | 29 const int kKeyVersion = 6; |
| 30 const char kKeyPubBytesBase64[] = | 30 const char kKeyPubBytesBase64[] = |
| 31 "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEj0QKufXIOBN30DtKeOYA5NV64FfY" | 31 "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAECEDSRcZPKv8k4JEYbF7MJxxx56m+x8Z+svg5gB" |
| 32 "HDou4sGqtcNUIlxpTzIbO45rB45QILhW6aDTwwjWLR1YCqpEAGICvFs8dQ=="; | 32 "mRX1J8A9DYRL6NvFkNcmcRtSNemUm7/iqrUnxaadkqcWSODw=="; |
| 33 | 33 |
| 34 // The ETag header carries the ECSDA signature of the protocol response, if | 34 // The ETag header carries the ECSDA signature of the protocol response, if |
| 35 // signing has been used. | 35 // signing has been used. |
| 36 const char kHeaderEtag[] = "ETag"; | 36 const char kHeaderEtag[] = "ETag"; |
| 37 | 37 |
| 38 // The server uses the optional X-Retry-After header to indicate that the | 38 // The server uses the optional X-Retry-After header to indicate that the |
| 39 // current request should not be attempted again. Any response received along | 39 // current request should not be attempted again. Any response received along |
| 40 // with the X-Retry-After header should be interpreted as it would have been | 40 // with the X-Retry-After header should be interpreted as it would have been |
| 41 // without the X-Retry-After header. | 41 // without the X-Retry-After header. |
| 42 // | 42 // |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 218 } |
| 219 | 219 |
| 220 int64_t RequestSender::GetInt64HeaderValue(const net::URLFetcher* source, | 220 int64_t RequestSender::GetInt64HeaderValue(const net::URLFetcher* source, |
| 221 const char* header_name) { | 221 const char* header_name) { |
| 222 auto* response_headers(source->GetResponseHeaders()); | 222 auto* response_headers(source->GetResponseHeaders()); |
| 223 return response_headers ? response_headers->GetInt64HeaderValue(header_name) | 223 return response_headers ? response_headers->GetInt64HeaderValue(header_name) |
| 224 : -1; | 224 : -1; |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace update_client | 227 } // namespace update_client |
| OLD | NEW |