Skip to content

Class HTTPClient

ClassList > HTTPClient

Public Functions

Type Name
int GET ()
request handling
HTTPClient ()
int PATCH (uint8_t * payload, size_t size)
int PATCH (String payload)
int POST (uint8_t * payload, size_t size)
int POST (String payload)
int PUT (uint8_t * payload, size_t size)
int PUT (String payload)
void addHeader (const String & name, const String & value, bool first=false, bool replace=true)
bool begin (WiFiClient & client, String url)
bool begin (WiFiClient & client, String host, uint16_t port, String uri="/", bool https=false)
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 clearAllCookies ()
void collectHeaders (const char * headerKeys, const size_t headerKeysCount)
Response handling.
bool connected (void)
void end (void)
const String & getLocation (void)
int getSize (void)
WiFiClient & getStream (void)
WiFiClient * getStreamPtr (void)
bool hasHeader (const char * name)
String header (const char * name)
String header (size_t i)
String headerName (size_t i)
int headers ()
void resetCookieJar ()
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 setAuthorization (const char * user, const char * password)
void setAuthorization (const char * auth)
void setAuthorizationType (const char * authType)
void setConnectTimeout (int32_t connectTimeout)
void setCookieJar (CookieJar * cookieJar)
Cookie jar support.
void setFollowRedirects (followRedirects_t follow)
void setRedirectLimit (uint16_t limit)
void setReuse (bool reuse)
void setTimeout (uint16_t timeout)
bool setURL (const String & url)
void setUserAgent (const String & userAgent)
keep-alive
void useHTTP10 (bool usehttp10=true)
int writeToStream (Stream * stream)
~HTTPClient ()

Public Static Functions

Type Name
String errorToString (int error)

Protected Attributes

Type Name
String _authorizationType = = "Basic"
String _base64Authorization
bool _canReuse = = false
WiFiClient * _client = = nullptr
int32_t _connectTimeout = = -1
CookieJar * _cookieJar = = nullptr
Cookie jar support.
RequestArgument * _currentHeaders = = nullptr
Response handling.
followRedirects_t _followRedirects = = HTTPC_DISABLE_FOLLOW_REDIRECTS
size_t _headerKeysCount = = 0
String _headers
String _host
request handling
String _location
uint16_t _port = = 0
String _protocol
uint16_t _redirectLimit = = 10
int _returnCode = = 0
bool _reuse = = true
bool _secure = = false
int _size = = -1
std::unique_ptr< WiFiClient > _tcpDeprecated
uint16_t _tcpTimeout = = HTTPCLIENT_DEFAULT_TCP_TIMEOUT
transferEncoding_t _transferEncoding = = HTTPC_TE_IDENTITY
TransportTraitsPtr _transportTraits
String _uri
bool _useHTTP10 = = false
String _userAgent = = "ESP32HTTPClient"

Protected Functions

Type Name
bool beginInternal (String url, const char * expectedProtocol)
void clear ()
bool connect (void)
void disconnect (bool preserveClient=false)
bool generateCookieString (String * cookieString)
int handleHeaderResponse ()
int returnError (int error)
bool sendHeader (const char * type)
void setCookie (String date, String headerValue)
Cookie jar support.
int writeToStreamDataBlock (Stream * stream, int len)

Public Functions Documentation

function GET

int HTTPClient::GET () 

function HTTPClient

HTTPClient::HTTPClient () 

function PATCH [1/2]

int HTTPClient::PATCH (
    uint8_t * payload,
    size_t size
) 

function PATCH [2/2]

int HTTPClient::PATCH (
    String payload
) 

function POST [1/2]

int HTTPClient::POST (
    uint8_t * payload,
    size_t size
) 

function POST [2/2]

int HTTPClient::POST (
    String payload
) 

function PUT [1/2]

int HTTPClient::PUT (
    uint8_t * payload,
    size_t size
) 

function PUT [2/2]

int HTTPClient::PUT (
    String payload
) 

function addHeader

void HTTPClient::addHeader (
    const String & name,
    const String & value,
    bool first=false,
    bool replace=true
) 

function begin [1/7]

bool HTTPClient::begin (
    WiFiClient & client,
    String url
) 

function begin [2/7]

bool HTTPClient::begin (
    WiFiClient & client,
    String host,
    uint16_t port,
    String uri="/",
    bool https=false
) 

function begin [3/7]

bool HTTPClient::begin (
    String url
) 

function begin [4/7]

bool HTTPClient::begin (
    String url,
    const char * CAcert
) 

function begin [5/7]

bool HTTPClient::begin (
    String host,
    uint16_t port,
    String uri="/"
) 

function begin [6/7]

bool HTTPClient::begin (
    String host,
    uint16_t port,
    String uri,
    const char * CAcert
) 

function begin [7/7]

bool HTTPClient::begin (
    String host,
    uint16_t port,
    String uri,
    const char * CAcert,
    const char * cli_cert,
    const char * cli_key
) 

function clearAllCookies

void HTTPClient::clearAllCookies () 

function collectHeaders

void HTTPClient::collectHeaders (
    const char * headerKeys,
    const size_t headerKeysCount
) 

function connected

bool HTTPClient::connected (
    void
) 

function end

void HTTPClient::end (
    void
) 

function getLocation

const String & HTTPClient::getLocation (
    void
) 

function getSize

int HTTPClient::getSize (
    void
) 

function getStream

WiFiClient & HTTPClient::getStream (
    void
) 

function getStreamPtr

WiFiClient * HTTPClient::getStreamPtr (
    void
) 

function hasHeader

bool HTTPClient::hasHeader (
    const char * name
) 

function header [1/2]

String HTTPClient::header (
    const char * name
) 

function header [2/2]

String HTTPClient::header (
    size_t i
) 

function headerName

String HTTPClient::headerName (
    size_t i
) 

function headers

int HTTPClient::headers () 

function resetCookieJar

void HTTPClient::resetCookieJar () 

function sendRequest [1/3]

int HTTPClient::sendRequest (
    const char * type,
    String payload
) 

function sendRequest [2/3]

int HTTPClient::sendRequest (
    const char * type,
    uint8_t * payload=NULL,
    size_t size=0
) 

function sendRequest [3/3]

int HTTPClient::sendRequest (
    const char * type,
    Stream * stream,
    size_t size=0
) 

function setAuthorization [1/2]

void HTTPClient::setAuthorization (
    const char * user,
    const char * password
) 

function setAuthorization [2/2]

void HTTPClient::setAuthorization (
    const char * auth
) 

function setAuthorizationType

void HTTPClient::setAuthorizationType (
    const char * authType
) 

function setConnectTimeout

void HTTPClient::setConnectTimeout (
    int32_t connectTimeout
) 

function setCookieJar

void HTTPClient::setCookieJar (
    CookieJar * cookieJar
) 

function setFollowRedirects

void HTTPClient::setFollowRedirects (
    followRedirects_t follow
) 

function setRedirectLimit

void HTTPClient::setRedirectLimit (
    uint16_t limit
) 

function setReuse

void HTTPClient::setReuse (
    bool reuse
) 

function setTimeout

void HTTPClient::setTimeout (
    uint16_t timeout
) 

function setURL

bool HTTPClient::setURL (
    const String & url
) 

function setUserAgent

void HTTPClient::setUserAgent (
    const String & userAgent
) 

function useHTTP10

void HTTPClient::useHTTP10 (
    bool usehttp10=true
) 

function writeToStream

int HTTPClient::writeToStream (
    Stream * stream
) 

function ~HTTPClient

HTTPClient::~HTTPClient () 

Public Static Functions Documentation

function errorToString

static String HTTPClient::errorToString (
    int error
) 

Protected Attributes Documentation

variable _authorizationType

String HTTPClient::_authorizationType;

variable _base64Authorization

String HTTPClient::_base64Authorization;

variable _canReuse

bool HTTPClient::_canReuse;

variable _client

WiFiClient* HTTPClient::_client;

variable _connectTimeout

int32_t HTTPClient::_connectTimeout;

variable _cookieJar

CookieJar* HTTPClient::_cookieJar;

variable _currentHeaders

RequestArgument* HTTPClient::_currentHeaders;

variable _followRedirects

followRedirects_t HTTPClient::_followRedirects;

variable _headerKeysCount

size_t HTTPClient::_headerKeysCount;

variable _headers

String HTTPClient::_headers;

variable _host

String HTTPClient::_host;

variable _location

String HTTPClient::_location;

variable _port

uint16_t HTTPClient::_port;

variable _protocol

String HTTPClient::_protocol;

variable _redirectLimit

uint16_t HTTPClient::_redirectLimit;

variable _returnCode

int HTTPClient::_returnCode;

variable _reuse

bool HTTPClient::_reuse;

variable _secure

bool HTTPClient::_secure;

variable _size

int HTTPClient::_size;

variable _tcpDeprecated

std::unique_ptr<WiFiClient> HTTPClient::_tcpDeprecated;

variable _tcpTimeout

uint16_t HTTPClient::_tcpTimeout;

variable _transferEncoding

transferEncoding_t HTTPClient::_transferEncoding;

variable _transportTraits

TransportTraitsPtr HTTPClient::_transportTraits;

variable _uri

String HTTPClient::_uri;

variable _useHTTP10

bool HTTPClient::_useHTTP10;

variable _userAgent

String HTTPClient::_userAgent;

Protected Functions Documentation

function beginInternal

bool HTTPClient::beginInternal (
    String url,
    const char * expectedProtocol
) 

function clear

void HTTPClient::clear () 

function connect

bool HTTPClient::connect (
    void
) 

function disconnect

void HTTPClient::disconnect (
    bool preserveClient=false
) 

function generateCookieString

bool HTTPClient::generateCookieString (
    String * cookieString
) 

function handleHeaderResponse

int HTTPClient::handleHeaderResponse () 

function returnError

int HTTPClient::returnError (
    int error
) 

function sendHeader

bool HTTPClient::sendHeader (
    const char * type
) 

function setCookie

void HTTPClient::setCookie (
    String date,
    String headerValue
) 

function writeToStreamDataBlock

int HTTPClient::writeToStreamDataBlock (
    Stream * stream,
    int len
) 

The documentation for this class was generated from the following file cores/common/arduino/libraries/ext/HTTPClient/HTTPClient.h