|
|
@ -272,21 +272,13 @@ std::optional<std::string> launchpad::api_get(const std::string endpoint, const
|
|
|
|
while (tries < 5) {
|
|
|
|
while (tries < 5) {
|
|
|
|
tries++;
|
|
|
|
tries++;
|
|
|
|
CURLcode res = curl_easy_perform(curl);
|
|
|
|
CURLcode res = curl_easy_perform(curl);
|
|
|
|
if (res != CURLE_OK) {
|
|
|
|
if (res != CURLE_OK) { continue; }
|
|
|
|
std::cerr << "CURL GET error: " << curl_easy_strerror(res) << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
|
|
|
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
|
|
|
|
curl_slist_free_all(headers);
|
|
|
|
curl_slist_free_all(headers);
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
|
|
|
|
|
|
|
|
if (res != CURLE_OK) {
|
|
|
|
if (res != CURLE_OK || http_code >= 400) { continue; }
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (http_code >= 400) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return readBuffer;
|
|
|
|
return readBuffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -358,21 +350,13 @@ std::optional<std::string> launchpad::api_post(
|
|
|
|
while (tries < 5) {
|
|
|
|
while (tries < 5) {
|
|
|
|
tries++;
|
|
|
|
tries++;
|
|
|
|
CURLcode res = curl_easy_perform(curl);
|
|
|
|
CURLcode res = curl_easy_perform(curl);
|
|
|
|
if (res != CURLE_OK) {
|
|
|
|
if (res != CURLE_OK) { continue; }
|
|
|
|
std::cerr << "CURL POST error: " << curl_easy_strerror(res) << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
|
|
|
|
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code);
|
|
|
|
curl_slist_free_all(headers);
|
|
|
|
curl_slist_free_all(headers);
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
|
|
|
|
|
|
|
|
if (res != CURLE_OK) {
|
|
|
|
if (res != CURLE_OK || http_code >= 400) { continue; }
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (http_code >= 400) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return readBuffer;
|
|
|
|
return readBuffer;
|
|
|
|
}
|
|
|
|
}
|
|
|
|