mirror of
https://github.com/esphome/esphome.git
synced 2026-02-19 07:55:35 -07:00
[http_request] Fix infinite loop on read error in update component
The update component had the same infinite loop issue as the OTA component when network read errors occurred. If container->read() returned an error (negative value), it would be added to read_index and the loop would continue indefinitely since get_bytes_read() would never reach content_length. This fix breaks out of the read loop on any read error (read_bytes <= 0), preventing watchdog resets and infinite loops during manifest downloads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,11 @@ void HttpRequestUpdate::update_task(void *params) {
|
||||
|
||||
yield();
|
||||
|
||||
if (read_bytes <= 0) {
|
||||
// Network error or connection closed - break to avoid infinite loop
|
||||
break;
|
||||
}
|
||||
|
||||
read_index += read_bytes;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user