| 106 | } |
| 107 | |
| 108 | NameDiffInfoMap Load(LocalMapsInfo const & info) |
| 109 | { |
| 110 | if (info.m_localMaps.empty() || DIFF_LIST_URL[0] == 0) |
| 111 | return {}; |
| 112 | |
| 113 | platform::HttpClient request(DIFF_LIST_URL); |
| 114 | string const body = SerializeCheckerData(info); |
| 115 | ASSERT(!body.empty(), ()); |
| 116 | request.SetBodyData(body, "application/json"); |
| 117 | request.SetTimeout(kTimeoutInSeconds); |
| 118 | NameDiffInfoMap diffs; |
| 119 | if (request.RunHttpRequest() && !request.WasRedirected() && request.ErrorCode() == 200) |
| 120 | { |
| 121 | diffs = DeserializeResponse(request.ServerResponse(), info.m_localMaps); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | ostringstream ost; |
| 126 | ost << "Request to diffs server failed. Code = " << request.ErrorCode() |
| 127 | << ", redirection = " << request.WasRedirected(); |
| 128 | LOG(LINFO, (ost.str())); |
| 129 | } |
| 130 | |
| 131 | return diffs; |
| 132 | } |
| 133 | } // namespace |
| 134 | |
| 135 | namespace storage |