Add custom headers to OTA update

dmaxben
Posts: 108
Joined: Thu Nov 16, 2017 6:04 pm

Add custom headers to OTA update

Postby dmaxben » Sat Apr 18, 2020 6:11 pm

Does anyone have any idea how to add/send custom headers when making an OTA firmware request?

My custom firmware update server requires some custom information from the ESP32 before it pushes a firmware/SPIFFS bin...but I cant figure out how to adapt/slip in custom headers simultaneously with the OTA process.

My project originally used the Arduino httpUpdate/OTA library, and it was really easy to add/send additional custom http headers before a firmware update request.

However I have since migrated to using ESP-IDF (v3.3), and cant figure out how to adapt/modify the IDF OTA example code to have the ESP32 send custom headers right before the OTA firmware request...
Last edited by dmaxben on Thu May 21, 2020 10:40 pm, edited 1 time in total.


pdemianczuk
Posts: 28
Joined: Thu May 30, 2019 12:05 pm

Re: Add custom headers to OTA update

Postby pdemianczuk » Fri Apr 23, 2021 11:36 am

If I understand well, the method/function

esp_http_client_set_header(...)
base on esp_http_client and used a param whis is type esp_http_client_handle_t

but functions esp_https_ota_get_img_desc(...) or
esp_https_ota_perform(...)
used a param https_ota_handle_t
and this a diffrent object/type
Am I right?

If I uderstand well, in <esp_http_client> module we have one of the first step like:
client esp_http_client_handle_t esp_http_client_init(const esp_http_client_config_t *config);
and function esp_http_client_set_header(...) modify header before we sent anything,


pdemianczuk
Posts: 28
Joined: Thu May 30, 2019 12:05 pm

Re: Add custom headers to OTA update

Postby pdemianczuk » Tue May 04, 2021 7:47 am

Thank you, indeed Callback solve this aspect.

Who is online

Users browsing this forum: Bing [Bot] and 129 guests