When CONFIG_ESP_HTTP_CLIENT_STRICT_HEADER_BUFFER is enabled,
esp_http_client_request_send() fails fast when a single request header is
larger than buffer_size_tx, instead of silently emitting a truncated request.
The condition is reported with a dedicated ESP_ERR_HTTP_HEADER_TOO_LONG error
code rather than overloading ESP_ERR_HTTP_WRITE_DATA, so callers can tell a
permanent header-sizing failure apart from a transient write error. errno is
cleared on this path so the async caller (which maps errno == EAGAIN to "retry
later") does not spin retrying a request that can never succeed.
Closes https://github.com/espressif/esp-idf/issues/18639
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add ESP_KEY_SOURCE_BUFFER and ESP_KEY_SOURCE_PSA key sources so all
hardware backends (DS, ECDSA, secure element) are accessed via PSA
key IDs through a single esp_tls_cfg_t.client_key field.
esp_http_client_set_redirection() now rejects any redirect target whose
scheme is not https:// when the origin is HTTPS. This catches http, ftp,
ws and any other scheme before client state is mutated. Same-host /
https-to-https redirects are unaffected. Apps that intentionally want
mixed-scheme redirects can set disable_auto_redirect=true and handle
HTTP_EVENT_REDIRECT.
This commit added new http state HTTP_STATE_CONNECTING, and made states public.
Also added public API to get current state.
Updated state flow in esp_http_client_perform()
Closes https://github.com/espressif/esp-idf/issues/16019
This commit fixes an issue encountered during OTA when partial download
is enabled using an AWS signed URL restricted to GET requests.
It also adds an API to retrieve the OTA image size from the Content-Range header.
Problem:
1. In low-memory scenarios, the dynamic buffer feature can fail due to memory fragmentation.
2. It requires a contiguous 16KB heap chunk, but continuous allocation and deallocation of
the RX buffer can lead to fragmentation.
3. If another component allocates memory between these operations, it can break up the
available 16KB block, causing allocation failure.
Solution:
1. Introduce configurable strategy for using dynamic buffers in TLS connections.
2. For example, convert RX buffers to static after the TLS handshake.
3. Allow users to select the strategy via a new field in the esp_http_client_cfg_t structure.
4. The strategy can be controlled independently for each TLS session.
When parsing ND-JSON streams, this is needed to indicate the
point when the ND-JSON stream is considered open, which
occurs just after the last HTTP_EVENT_ON_HEADER.
ND-JSON stream clients cannot rely on the first HTTP_EVENT_ON_DATA,
since that is only triggered by an event, which are optional and
may never be sent, or only sent well after the last HTTP_EVENT_ON_HEADER.
Closes#15952
- esp_http_client support just PEM ca_cert and client_cert.
- Although esp_tls supports both PEM and DER certificate. We have logic
based on cert_len and client_cert_len which decides whether given cert or client_cert
is in PEM or DER format.
- If length is 0 then it is PEM certificate and if length is passed then DER is
considered. This is true for both ca_cert and client_cert
This commits allow to pass the DER certificate in esp_http_client
This commit replace macro MEM_CHECK with return on failure and
updated usage of reespctive APIs' in IDF.
This also update th prototype of API esp_http_client_add_auth().
Closes https://github.com/espressif/esp-idf/issues/14463
Added support http REPORT method and tested it using local server.
Added test case for REPOPRT method in esp_http_client_example.c
The URL(httpbin.org) does not support for /report endpoint.
Closes https://github.com/espressif/esp-idf/issues/14147