Retry provisioning and license requests on 502 errors

[ Merge of http://go/wvgerrit/219370 ]

Work around the server problem.

Bug: 345333545
Change-Id: Ie1b0021f545c77d61bb2363494239f4fe000f3d5
This commit is contained in:
Alex Dale
2025-04-18 12:24:53 -07:00
parent 25380c8832
commit 3d5bdaeb77
4 changed files with 64 additions and 34 deletions

View File

@@ -29,7 +29,8 @@ class UrlRequest {
bool GetResponse(std::string* message);
static int GetStatusCode(const std::string& response);
// Get the response, and expect the status is OK.
void AssertOkResponse(std::string* message);
// It will retry if the response code is in the 500 range.
void AssertOkResponseWithRetry(std::string* message);
static bool GetDebugHeaderFields(
const std::string& response,
@@ -37,9 +38,11 @@ class UrlRequest {
private:
bool PostRequestWithPath(const std::string& path, const std::string& data);
bool SendRequestOnce();
bool is_connected_;
HttpSocket socket_;
std::string request_;
CORE_DISALLOW_COPY_AND_ASSIGN(UrlRequest);
};