setup: add serial to request headers (#27237)

* setup: add dongle ID to request headers

* rename openpilot

* fix str

* hardware: get_serial

* set serial instead

* fix typo

* static

* fixes
old-commit-hash: 6fb5661abba34971e547941e0f6a6625bef3b75a
This commit is contained in:
Cameron Clough
2023-02-06 20:02:30 -08:00
committed by GitHub
parent 3daa82e5a1
commit 0276badcc0
3 changed files with 24 additions and 0 deletions
+5
View File
@@ -29,6 +29,9 @@ void Setup::download(QString url) {
auto version = util::read_file("/VERSION");
struct curl_slist *list = NULL;
list = curl_slist_append(list, ("X-openpilot-serial: " + Hardware::get_serial()).c_str());
char tmpfile[] = "/tmp/installer_XXXXXX";
FILE *fp = fdopen(mkstemp(tmpfile), "w");
@@ -38,6 +41,7 @@ void Setup::download(QString url) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_USERAGENT, (USER_AGENT + version).c_str());
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, list);
int ret = curl_easy_perform(curl);
@@ -50,6 +54,7 @@ void Setup::download(QString url) {
emit finished(false);
}
curl_slist_free_all(list);
curl_easy_cleanup(curl);
fclose(fp);
}