espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.83k stars 7.32k forks source link

OTA: Reuse HTTP connection when performing partial HTTPS downloads (IDFGH-13949) #14783

Open admarschoonen-joule opened 1 month ago

admarschoonen-joule commented 1 month ago

Is your feature request related to a problem?

If OTA is configured to do a partial HTTP download over HTTPS, I noticed that it closes the HTTP connection after every 4 KB that it has received, and opens a new connection for the following 4 KB. It would be nice if it could reuse this connection to save time on DNS requests and setting up / tearing down HTTP and TLS sessions.

Describe the solution you'd like.

No response

Describe alternatives you've considered.

No response

Additional context.

No response

nileshkale123 commented 4 weeks ago

Hello @admarschoonen-joule ,

Yes, we agree with you and have already identified this issue. We’ll be implementing a fix for it shortly.

admarschoonen-joule commented 4 weeks ago

Hi @nileshkale123 ,

Thanks for you quick reply. Can you give an estimation of when this fix will be released and which ESP-IDF version number will have the fix?

Thanks in advance.

nileshkale123 commented 4 weeks ago

Hello @admarschoonen-joule ,

We’ll work to complete this as soon as possible and will backport it to the necessary releases. Once the patch is ready, I’ll share it with you so you can proceed ahead.

admarschoonen-joule commented 4 weeks ago

Hi @nileshkale123 ,

Thanks a lot! Looking forward to the improvement!

nileshkale123 commented 2 weeks ago

Hello @admarschoonen-joule,

I’m attaching a patch that enables the session resumption feature in the advanced_ota example in IDF. This approach maintains the current flow, where each range request initiates a new connection, rather than persisting a single connection across all range requests.

Although session resumptionis quite slower than using a fully persistent connection, it provides significant advantages in low-bandwidth or unreliable network conditions and requires fewer resources.

Please review the patch and let us know your thoughts. If you have any specific requirements or preferences regarding the implementation, feel free to share them so we can work closely to meet your needs.

partial_ota.txt