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