SDK  23.9.2
For IoT System Software Development
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
HTTPClient Class Reference

Classes

struct  RequestArgument
 

Public Member Functions

bool begin (String url)
 
bool begin (String url, const char *CAcert)
 
bool begin (String host, uint16_t port, String uri="/")
 
bool begin (String host, uint16_t port, String uri, const char *CAcert)
 
bool begin (String host, uint16_t port, String uri, const char *CAcert, const char *cli_cert, const char *cli_key)
 
void end (void)
 
bool connected (void)
 
void setReuse (bool reuse)
 
void setUserAgent (const String &userAgent)
 keep-alive
 
void setAuthorization (const char *user, const char *password)
 
void setAuthorization (const char *auth)
 
void setTimeout (uint16_t timeout)
 
void useHTTP10 (bool usehttp10=true)
 
int GET ()
 request handling
 
int POST (uint8_t *payload, size_t size)
 
int POST (String payload)
 
int PUT (uint8_t *payload, size_t size)
 
int PUT (String payload)
 
int sendRequest (const char *type, String payload)
 
int sendRequest (const char *type, uint8_t *payload=NULL, size_t size=0)
 
int sendRequest (const char *type, Stream *stream, size_t size=0)
 
void addHeader (const String &name, const String &value, bool first=false, bool replace=true)
 
void collectHeaders (const char *headerKeys[], const size_t headerKeysCount)
 Response handling.
 
String header (const char *name)
 
String header (size_t i)
 
String headerName (size_t i)
 
int headers ()
 
bool hasHeader (const char *name)
 
int getSize (void)
 
TCPClientgetStreamPtr (void)
 
int writeToStream (Stream *stream)
 
String getString (void)
 

Static Public Member Functions

static String errorToString (int error)
 

Protected Member Functions

bool beginInternal (String url, const char *expectedProtocol)
 
void clear ()
 
int returnError (int error)
 
bool connect (void)
 
bool sendHeader (const char *type)
 
int handleHeaderResponse ()
 
int writeToStreamDataBlock (Stream *stream, int len)
 

Protected Attributes

TransportTraits * _transportTraits
 
TCPClient_tcp
 
String _host
 request handling
 
uint16_t _port = 0
 
bool _reuse = false
 
uint16_t _tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT
 
bool _useHTTP10 = false
 
bool _secure = false
 
String _uri
 
String _protocol
 
String _headers
 
String _userAgent = "ESP32HTTPClient"
 
String _base64Authorization
 
RequestArgument_currentHeaders = nullptr
 Response handling.
 
size_t _headerKeysCount = 0
 
int _returnCode = 0
 
int _size = -1
 
bool _canReuse = false
 
transferEncoding_t _transferEncoding = HTTPC_TE_IDENTITY
 

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