mirror of
https://github.com/esphome/esphome.git
synced 2026-02-19 07:55:35 -07:00
f20f3e052599b152463dfb72bdeb497654f310b3
This commit fixes an issue where the http_request component would enter an infinite loop when an HTTP server doesn't send a Content-Length header or closes the connection prematurely. The read loop was assuming read operations would always return data, but: 1. When the stream pointer becomes invalid (connection closed), read() returns -1 2. When no more data is available, read() returns 0 Without these checks, the loop would continue indefinitely, causing: - "Stream pointer vanished!" errors (Arduino platform) - CPU spinning on zero-byte reads - Watchdog timeouts The fix adds validation checks to break out of read loops when read() returns <= 0 (covering both error and end-of-stream conditions). This is applied to: - Response capture loops (http_request.h) - OTA firmware download loop (ota_http_request.cpp) - MD5 verification download loop (ota_http_request.cpp) This allows graceful handling of non-compliant HTTP servers while maintaining compatibility with properly formatted responses. Fixes esphome/issues#6682 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Description
ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.
Readme
Multiple Licenses
373 MiB
Languages
C++
64.2%
Python
35.5%
C
0.2%
