From 4e67898073c08b5f4b76d541b3e81dc53013be86 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 28 Jan 2026 06:45:14 -1000 Subject: [PATCH] improve comment --- esphome/components/http_request/http_request_arduino.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/http_request/http_request_arduino.cpp b/esphome/components/http_request/http_request_arduino.cpp index 16f999c671..82538b2cb3 100644 --- a/esphome/components/http_request/http_request_arduino.cpp +++ b/esphome/components/http_request/http_request_arduino.cpp @@ -171,8 +171,8 @@ int HttpContainerArduino::read(uint8_t *buf, size_t max_len) { } int available_data = stream_ptr->available(); - // For chunked transfer encoding, content_length is effectively unknown, so don't limit by it. - // HTTPClient::getSize() returns -1 for chunked, which becomes SIZE_MAX when cast to size_t. + // For chunked transfer encoding, HTTPClient::getSize() returns -1, which becomes SIZE_MAX when + // cast to size_t. SIZE_MAX - bytes_read_ is still huge, so it won't limit the read. size_t remaining = (this->content_length > 0) ? (this->content_length - this->bytes_read_) : max_len; int bufsize = std::min(max_len, std::min(remaining, (size_t) available_data));