mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
ui/setup: check http status code (#23597)
* check resp code
* always cleanup curl and close file
* curl_global_init
* space
* cleaner
* Revert "curl_global_init"
This reverts commit c3f1a7cee87804993ce8f5fd5939570a8e9ffd3a.
old-commit-hash: 1e906366f8
This commit is contained in:
@@ -37,15 +37,18 @@ void Setup::download(QString url) {
|
||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT);
|
||||
|
||||
int ret = curl_easy_perform(curl);
|
||||
if (ret != CURLE_OK) {
|
||||
|
||||
long res_status = 0;
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &res_status);
|
||||
if (ret == CURLE_OK && res_status == 200) {
|
||||
rename(tmpfile, "/tmp/installer");
|
||||
emit finished(true);
|
||||
} else {
|
||||
emit finished(false);
|
||||
return;
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
fclose(fp);
|
||||
|
||||
rename(tmpfile, "/tmp/installer");
|
||||
emit finished(true);
|
||||
}
|
||||
|
||||
QWidget * Setup::low_voltage() {
|
||||
|
||||
Reference in New Issue
Block a user