| Index: rlz/lib/rlz_lib.cc
|
| diff --git a/rlz/lib/rlz_lib.cc b/rlz/lib/rlz_lib.cc
|
| index 081f80b0d6a5915b180ebbbdb79404b6f279e409..eb4c8d9bcc075f628cb76165bf6b3bca1c2e7f90 100644
|
| --- a/rlz/lib/rlz_lib.cc
|
| +++ b/rlz/lib/rlz_lib.cc
|
| @@ -14,9 +14,9 @@
|
| #include "base/strings/stringprintf.h"
|
| #include "build/build_config.h"
|
| #include "rlz/lib/assert.h"
|
| -#include "rlz/lib/crc32.h"
|
| #include "rlz/lib/financial_ping.h"
|
| #include "rlz/lib/lib_values.h"
|
| +#include "rlz/lib/net_response_check.h"
|
| #include "rlz/lib/rlz_value_store.h"
|
| #include "rlz/lib/string_utils.h"
|
|
|
| @@ -377,57 +377,6 @@ bool FormFinancialPingRequest(Product product, const AccessPoint* access_points,
|
| return true;
|
| }
|
|
|
| -bool IsPingResponseValid(const char* response, int* checksum_idx) {
|
| - if (!response || !response[0])
|
| - return false;
|
| -
|
| - if (checksum_idx)
|
| - *checksum_idx = -1;
|
| -
|
| - if (strlen(response) > kMaxPingResponseLength) {
|
| - ASSERT_STRING("IsPingResponseValid: response is too long to parse.");
|
| - return false;
|
| - }
|
| -
|
| - // Find the checksum line.
|
| - std::string response_string(response);
|
| -
|
| - std::string checksum_param("\ncrc32: ");
|
| - int calculated_crc;
|
| - int checksum_index = response_string.find(checksum_param);
|
| - if (checksum_index >= 0) {
|
| - // Calculate checksum of message preceeding checksum line.
|
| - // (+ 1 to include the \n)
|
| - std::string message(response_string.substr(0, checksum_index + 1));
|
| - if (!Crc32(message.c_str(), &calculated_crc))
|
| - return false;
|
| - } else {
|
| - checksum_param = "crc32: "; // Empty response case.
|
| - if (!base::StartsWith(response_string, checksum_param,
|
| - base::CompareCase::SENSITIVE))
|
| - return false;
|
| -
|
| - checksum_index = 0;
|
| - if (!Crc32("", &calculated_crc))
|
| - return false;
|
| - }
|
| -
|
| - // Find the checksum value on the response.
|
| - int checksum_end = response_string.find("\n", checksum_index + 1);
|
| - if (checksum_end < 0)
|
| - checksum_end = response_string.size();
|
| -
|
| - int checksum_begin = checksum_index + checksum_param.size();
|
| - std::string checksum = response_string.substr(checksum_begin,
|
| - checksum_end - checksum_begin + 1);
|
| - base::TrimWhitespaceASCII(checksum, base::TRIM_ALL, &checksum);
|
| -
|
| - if (checksum_idx)
|
| - *checksum_idx = checksum_index;
|
| -
|
| - return calculated_crc == HexStringToInteger(checksum.c_str());
|
| -}
|
| -
|
| // Complex helpers built on top of other functions.
|
|
|
| bool ParseFinancialPingResponse(Product product, const char* response) {
|
|
|