mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 00:31:58 +00:00
improve comment
This commit is contained in:
@@ -171,8 +171,8 @@ int HttpContainerArduino::read(uint8_t *buf, size_t max_len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int available_data = stream_ptr->available();
|
int available_data = stream_ptr->available();
|
||||||
// For chunked transfer encoding, content_length is effectively unknown, so don't limit by it.
|
// For chunked transfer encoding, HTTPClient::getSize() returns -1, which becomes SIZE_MAX when
|
||||||
// HTTPClient::getSize() returns -1 for chunked, which becomes SIZE_MAX when cast to size_t.
|
// 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;
|
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));
|
int bufsize = std::min(max_len, std::min(remaining, (size_t) available_data));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user