#include <http_request.h>
Definition at line 201 of file http_request.h.
◆ ~HttpContainer()
| virtual esphome::http_request::HttpContainer::~HttpContainer |
( |
| ) |
|
|
virtualdefault |
◆ end()
| virtual void esphome::http_request::HttpContainer::end |
( |
| ) |
|
|
pure virtual |
◆ get_bytes_read()
| size_t esphome::http_request::HttpContainer::get_bytes_read |
( |
| ) |
const |
|
inline |
◆ get_response_header()
| std::string esphome::http_request::HttpContainer::get_response_header |
( |
const std::string & | header_name | ) |
|
◆ get_response_headers()
| std::map< std::string, std::list< std::string > > esphome::http_request::HttpContainer::get_response_headers |
( |
| ) |
|
|
inline |
Get response headers.
- Returns
- The key is the lower case response header name, the value is the header value.
Definition at line 266 of file http_request.h.
◆ is_read_complete()
| virtual bool esphome::http_request::HttpContainer::is_read_complete |
( |
| ) |
const |
|
inlinevirtual |
Check if all expected content has been read.
Base implementation handles non-chunked responses and status-code-based no-body checks. Platform implementations may override for chunked completion detection:
- ESP-IDF: overrides to call esp_http_client_is_complete_data_received() for chunked.
- Arduino: read_chunked_() clears is_chunked_ and sets content_length on the final chunk, after which the base implementation detects completion.
Reimplemented in esphome::http_request::HttpContainerIDF.
Definition at line 249 of file http_request.h.
◆ read()
| virtual int esphome::http_request::HttpContainer::read |
( |
uint8_t * | buf, |
|
|
size_t | max_len ) |
|
pure virtual |
Read data from the HTTP response body.
WARNING: These semantics differ from BSD sockets! BSD sockets: 0 = EOF (connection closed) This method: 0 = no data yet OR all content read, negative = error/closed
- Parameters
-
| buf | Buffer to read data into |
| max_len | Maximum number of bytes to read |
- Returns
- > 0: Number of bytes read successfully
- 0: No data available yet OR all content read (check get_bytes_read() >= content_length to distinguish)
- HTTP_ERROR_CONNECTION_CLOSED (-1): Connection closed prematurely
- < -1: Other error (platform-specific error code)
Platform notes:
- ESP-IDF: blocking read, 0 only when all content read
- Arduino: non-blocking, 0 can mean "no data yet" or "all content read"
Use get_bytes_read() and content_length to track progress. When get_bytes_read() >= content_length, all data has been received.
IMPORTANT: Do not use raw return values directly. Use these helpers:
Implemented in esphome::http_request::HttpContainerArduino, esphome::http_request::HttpContainerHost, and esphome::http_request::HttpContainerIDF.
◆ set_chunked()
| void esphome::http_request::HttpContainer::set_chunked |
( |
bool | chunked | ) |
|
|
inline |
◆ set_secure()
| void esphome::http_request::HttpContainer::set_secure |
( |
bool | secure | ) |
|
|
inline |
◆ bytes_read_
| size_t esphome::http_request::HttpContainer::bytes_read_ {0} |
|
protected |
◆ content_length
| size_t esphome::http_request::HttpContainer::content_length {0} |
◆ duration_ms
| uint32_t esphome::http_request::HttpContainer::duration_ms {0} |
◆ is_chunked_
| bool esphome::http_request::HttpContainer::is_chunked_ {false} |
|
protected |
True if response uses chunked transfer encoding.
Definition at line 273 of file http_request.h.
◆ response_headers_
| std::map<std::string, std::list<std::string> > esphome::http_request::HttpContainer::response_headers_ {} |
|
protected |
◆ secure_
| bool esphome::http_request::HttpContainer::secure_ {false} |
|
protected |
◆ status_code
| int esphome::http_request::HttpContainer::status_code {-1} |
The documentation for this class was generated from the following files: