ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::http_request::HttpContainerIDF Class Reference

#include <http_request_idf.h>

Inheritance diagram for esphome::http_request::HttpContainerIDF:
esphome::http_request::HttpContainer esphome::Parented< HttpRequestComponent >

Public Member Functions

 HttpContainerIDF (esp_http_client_handle_t client)
 
int read (uint8_t *buf, size_t max_len) override
 
int read_available (uint8_t *buf, size_t max_len) override
 
void end () override
 
bool is_read_complete () const override
 
HttpRequestProgress poll () override
 
void feed_wdt ()
 Feeds the watchdog timer if the executing task has one attached.
 
- Public Member Functions inherited from esphome::http_request::HttpContainer
virtual ~HttpContainer ()=default
 
void set_secure (bool secure)
 
void set_watchdog_timeout (uint32_t watchdog_timeout)
 
uint32_t get_watchdog_timeout () const
 
void set_chunked (bool chunked)
 
size_t get_bytes_read () const
 
std::string get_response_header (const std::string &header_name)
 Get the value of a response header by name.
 
- Public Member Functions inherited from esphome::Parented< HttpRequestComponent >
 Parented ()
 
 Parented (HttpRequestComponent *parent)
 
HttpRequestComponent * get_parent () const
 Get the parent of this object.
 
void set_parent (HttpRequestComponent *parent)
 Set the parent of this object.
 

Protected Types

enum class  Stage : uint8_t {
  STAGE_CONNECT , STAGE_SEND_BODY , STAGE_HEADERS , STAGE_DONE ,
  STAGE_FAILED
}
 

Protected Member Functions

int read_ (uint8_t *buf, size_t max_len)
 
bool socket_ready_ (bool write)
 True when the socket can be read or written without waiting; always true when it cannot be checked.
 
HttpRequestProgress wait_ ()
 
HttpRequestProgress fail_ (esp_err_t err)
 
HttpRequestProgress response_failed_ (int status_code)
 Finish with an unsuccessful status, which is reported through on_response like a success.
 
HttpRequestIDF * idf_parent_ ()
 

Protected Attributes

esp_http_client_handle_t client_
 
std::vector< std::string > collect_headers_
 
std::string body_
 
size_t body_sent_ {0}
 
uint32_t timeout_ms_ {0}
 
uint32_t progress_time_ {0}
 
uint32_t start_time_ {0}
 
uint16_t redirects_left_ {0}
 
Stage stage_ {Stage::STAGE_DONE}
 
bool connecting_ {false}
 
bool async_ {false}
 
- Protected Attributes inherited from esphome::http_request::HttpContainer
size_t bytes_read_ {0}
 
uint32_t watchdog_timeout_ {0}
 
bool secure_ {false}
 
bool is_chunked_ {false}
 True if response uses chunked transfer encoding.
 
std::vector< Header > response_headers_ {}
 
- Protected Attributes inherited from esphome::Parented< HttpRequestComponent >
HttpRequestComponent * parent_
 

Additional Inherited Members

- Data Fields inherited from esphome::http_request::HttpContainer
size_t content_length {0}
 
int status_code {-1}
 -1 indicates no response received yet
 
uint32_t duration_ms {0}
 

Detailed Description

Definition at line 22 of file http_request_idf.h.

Member Enumeration Documentation

◆ Stage

enum class esphome::http_request::HttpContainerIDF::Stage : uint8_t
strongprotected
Enumerator
STAGE_CONNECT 
STAGE_SEND_BODY 
STAGE_HEADERS 
STAGE_DONE 
STAGE_FAILED 

Definition at line 36 of file http_request_idf.h.

Constructor & Destructor Documentation

◆ HttpContainerIDF()

esphome::http_request::HttpContainerIDF::HttpContainerIDF ( esp_http_client_handle_t client)
inline

Definition at line 24 of file http_request_idf.h.

Member Function Documentation

◆ end()

void esphome::http_request::HttpContainerIDF::end ( )
overridevirtual

Implements esphome::http_request::HttpContainer.

Definition at line 460 of file http_request_idf.cpp.

◆ fail_()

HttpRequestProgress esphome::http_request::HttpContainerIDF::fail_ ( esp_err_t err)
protected

Definition at line 198 of file http_request_idf.cpp.

◆ feed_wdt()

void esphome::http_request::HttpContainerIDF::feed_wdt ( )

Feeds the watchdog timer if the executing task has one attached.

Definition at line 471 of file http_request_idf.cpp.

◆ idf_parent_()

HttpRequestIDF * esphome::http_request::HttpContainerIDF::idf_parent_ ( )
protected

Definition at line 196 of file http_request_idf.cpp.

◆ is_read_complete()

bool esphome::http_request::HttpContainerIDF::is_read_complete ( ) const
overridevirtual

Reimplemented from esphome::http_request::HttpContainer.

Definition at line 371 of file http_request_idf.cpp.

◆ poll()

HttpRequestProgress esphome::http_request::HttpContainerIDF::poll ( )
overridevirtual

Reimplemented from esphome::http_request::HttpContainer.

Definition at line 234 of file http_request_idf.cpp.

◆ read()

int esphome::http_request::HttpContainerIDF::read ( uint8_t * buf,
size_t max_len )
overridevirtual

Implements esphome::http_request::HttpContainer.

Definition at line 406 of file http_request_idf.cpp.

◆ read_()

int esphome::http_request::HttpContainerIDF::read_ ( uint8_t * buf,
size_t max_len )
protected

Definition at line 420 of file http_request_idf.cpp.

◆ read_available()

int esphome::http_request::HttpContainerIDF::read_available ( uint8_t * buf,
size_t max_len )
overridevirtual

Reimplemented from esphome::http_request::HttpContainer.

Definition at line 412 of file http_request_idf.cpp.

◆ response_failed_()

HttpRequestProgress esphome::http_request::HttpContainerIDF::response_failed_ ( int status_code)
protected

Finish with an unsuccessful status, which is reported through on_response like a success.

Definition at line 360 of file http_request_idf.cpp.

◆ socket_ready_()

bool esphome::http_request::HttpContainerIDF::socket_ready_ ( bool write)
protected

True when the socket can be read or written without waiting; always true when it cannot be checked.

Definition at line 213 of file http_request_idf.cpp.

◆ wait_()

HttpRequestProgress esphome::http_request::HttpContainerIDF::wait_ ( )
protected

Definition at line 205 of file http_request_idf.cpp.

Field Documentation

◆ async_

bool esphome::http_request::HttpContainerIDF::async_ {false}
protected

Definition at line 67 of file http_request_idf.h.

◆ body_

std::string esphome::http_request::HttpContainerIDF::body_
protected

Definition at line 57 of file http_request_idf.h.

◆ body_sent_

size_t esphome::http_request::HttpContainerIDF::body_sent_ {0}
protected

Definition at line 58 of file http_request_idf.h.

◆ client_

esp_http_client_handle_t esphome::http_request::HttpContainerIDF::client_
protected

Definition at line 53 of file http_request_idf.h.

◆ collect_headers_

std::vector<std::string> esphome::http_request::HttpContainerIDF::collect_headers_
protected

Definition at line 55 of file http_request_idf.h.

◆ connecting_

bool esphome::http_request::HttpContainerIDF::connecting_ {false}
protected

Definition at line 66 of file http_request_idf.h.

◆ progress_time_

uint32_t esphome::http_request::HttpContainerIDF::progress_time_ {0}
protected

Definition at line 61 of file http_request_idf.h.

◆ redirects_left_

uint16_t esphome::http_request::HttpContainerIDF::redirects_left_ {0}
protected

Definition at line 63 of file http_request_idf.h.

◆ stage_

Stage esphome::http_request::HttpContainerIDF::stage_ {Stage::STAGE_DONE}
protected

Definition at line 64 of file http_request_idf.h.

◆ start_time_

uint32_t esphome::http_request::HttpContainerIDF::start_time_ {0}
protected

Definition at line 62 of file http_request_idf.h.

◆ timeout_ms_

uint32_t esphome::http_request::HttpContainerIDF::timeout_ms_ {0}
protected

Definition at line 59 of file http_request_idf.h.


The documentation for this class was generated from the following files: