1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

improve comment

This commit is contained in:
J. Nick Koston
2026-01-28 06:45:14 -10:00
parent 0c868cbcc5
commit 4e67898073

View File

@@ -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));