Commit Graph

237 Commits

Author SHA1 Message Date
Ashish Sharma da9b3ce548 fix(esp_http_client): delete Content-Length header when using Transfer-Encoding
Closes https://github.com/espressif/esp-idf/issues/18242
2026-03-17 12:21:09 +08:00
nilesh.kale b7ef04f701 fix(esp_https_ota): handle ota resumption if server dosent support range requests
This commit added check to see if server supports range requets,
and fallback to OTA without resumption accordingly.

Closes https://github.com/espressif/esp-idf/pull/17960
2026-02-17 11:20:07 +05:30
Ashish Sharma 1e27eb204b feat(esp_http_client): adds API to get transport socket 2026-01-22 18:24:45 +08:00
Ashish Sharma 613b878df3 fix(esp_http_client): fix incorrect digest calculation for SHA256 auth digest
According to RFC 7616, nonce-prime and cnonce-prime is used for SHA-256-sess only and not for SHA-256.
This commit updates the check and uses nonce only for "-sess" algorithms.

Regression from 66995965e7
2026-01-07 10:19:04 +08:00
Mahavir Jain bbcc13be8b fix(esp_http_client): prevent out-of-bounds read in Digest auth
Fixed vulnerability where malicious HTTP servers could trigger OOB reads
by sending empty or very short algorithm fields in WWW-Authenticate headers.

Changes:
- Replace unsafe memcmp() with strcasecmp() for algorithm comparison
- Add algorithm NULL validation at function entry point
- Fix duplicate md5-sess check, add missing SHA-256 check
2025-12-01 18:23:29 +05:30
Mahavir Jain 1a760a91e5 Merge branch 'feature/add_ecdsa_p384_support_and_testcases_v5.5' into 'release/v5.5'
feat: add ecdsa-p384 testcases and relative support for ESP32C5 ECO2 (v5.5)

See merge request espressif/esp-idf!41274
2025-10-17 22:42:26 +05:30
nilesh.kale 534b4be9cb feat(esp_https_ota): Support partial downloading of OTA over single connection
This commit added support to download OTA with partial download feature
over single HTTP connection if server supports persistent connection.
2025-10-17 10:38:52 +05:30
nilesh.kale 364adc79c3 feat: added config member to store block number for high part of ecdsa key 2025-10-16 14:48:13 +08:00
nilesh.kale ba0618b672 feat: added new config member to provide ecdsa curve type 2025-10-16 14:48:13 +08:00
nilesh.kale 851602ed8e feat: add ecdsa-p384 testcases and relative support for ESP32C5 ECO2
This commit adds testcases in crypto/hal and mbedtls testapps.
2025-10-16 14:48:13 +08:00
nilesh.kale c09bb9fe46 fix(esp_http_client): fix dispatching of finish event condition
This commit updates the condition for dispatching of FINISH event.
With this, FINISH event will be dispatched after complete data is read.

Closes https://github.com/espressif/esp-idf/issues/17437
2025-09-12 10:20:16 +05:30
nilesh.kale f0ab806e7e feat(esp_http_client): handle error while reading data from server
This commit updated API esp_http_cleint_perform() to handle error and
dispatched error  event if any error occured whiling reading data from server.
2025-09-12 10:20:11 +05:30
nilesh.kale d9b99c42b3 feat(esp_http_client): avoid dispatching of spurious event while closing closes connection
This commit updated the client closing condition to avoid spurious
dispatching of event HTTP_EVENT_DISCONNECTED while closing closeed connection.

Closes https://github.com/espressif/esp-idf/issues/16070
2025-08-14 17:05:39 +05:30
Jiang Jiang Jian a8721f74cf Merge branch 'fix/regression_issue_in_digest_auth_v5.5' into 'release/v5.5'
fix(esp_http_client): fixed regression issue during enabling digest auth in client (v5.5)

See merge request espressif/esp-idf!41116
2025-08-08 20:07:13 +08:00
nilesh.kale 01481f08f9 fix(esp_http_client): fixed regression issue during enabling digest auth in client
This commit solved the issue introduced in commit a0bcffcce9
for enabling digest auth for esp_http_client.

Closes https://github.com/espressif/esp-idf/issues/17238
2025-08-08 09:47:36 +05:30
Ashish Sharma 8a8d01565e fix(esp_http_client): fix possible double memory free 2025-08-01 14:22:10 +08:00
Mahavir Jain 8d0b576c1e Merge branch 'contrib/github_pr_16076_v5.5' into 'release/v5.5'
fix(esp_http_client): fix spurious async open error (GitHub PR) (v5.5)

See merge request espressif/esp-idf!40740
2025-07-23 08:05:45 +05:30
Jiang Jiang Jian 32a7b6a30c Merge branch 'bugfix/fix_memory_leak_on_http_header_fetch_failure_v5.5' into 'release/v5.5'
fix(esp_http_client): free header in case of ESP_ERR_HTTP_FETCH_HEADER (v5.5)

See merge request espressif/esp-idf!40662
2025-07-22 17:35:29 +08:00
Richard Allen 784547465f fix(esp_http_client): fix spurious async open error
Fix esp_http_client_open() often triggering a
spurious HTTP_EVENT_ERROR when is_async=true.

Fixes https://github.com/espressif/esp-idf/issues/16075
2025-07-22 11:37:00 +05:30
Ashish Sharma ab8770fe5a fix(esp_http_client): fix memory leak in current_header_value buffer
Fixed memory leak in esp_http_client_cleanup() where current_header_value
buffer was not being freed when ESP_ERR_HTTP_FETCH_HEADER is returned
during header parsing failures.
2025-07-18 12:01:39 +08:00
hrushikesh.bhosale 2bfeb41d90 feat(mbedtls): Add configuration to control dynamic buffer strategy in mbedtls
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.
2025-06-18 15:01:17 +05:30
hrushikesh.bhosale 846a5c42ae feat(esp_http_client): Allow the DER certificates in esp_http_client
- 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
2025-04-23 19:59:39 +08:00
nilesh.kale 9c4c366d61 fix(esp_http_client): Added test case to verify set header functionality
This commit added testcase to verify esp_http_client_set_header
allows header value as NULL. Setting this NULL will delete the header.

Closes https://github.com/espressif/esp-idf/issues/15714
2025-04-04 21:00:45 +05:30
Mathew Harman 3c59f9e682 fix(esp_http_client): fix error return when set_header has value==NULL
Prior to v5.4, headers could be deleted from an HTTP client by calling
esp_http_client_set_header("Header", NULL). This pattern is used by
esp_http_client_set_post_field(NULL, 0), which is the only API usage
that will delete the request body in a persistent connection scenario.
2025-04-04 06:32:16 -04:00
Chen Jichang c34b4eb882 feat(esp32h4): enable ESP32H4 ci build 2025-03-28 14:41:28 +08:00
igor.udot daf2d31008 test: format all test scripts 2025-03-05 12:08:48 +08:00
Aditya Patwardhan 61f992a061 Merge branch 'contrib/github_pr_15291' into 'master'
fix(esp_http_client): Fix invalid content length header (GitHub PR)

Closes IDFGH-14528

See merge request espressif/esp-idf!37036
2025-02-25 13:03:12 +08:00
Bernhard Heinloth f31a0f7f61 fix(esp_http_client): Fix host header for IPv6 address literal
An IPv6 IP that occurs in the 'Host:' header of an HTTP request must be enclosed
in square brackets (RFC3986 section 3.2.2).

Searches for ':' in the host string to efficiently determine if the host is an
IPv6 IP address.
2025-02-19 10:41:05 +01:00
gaoxu 5ef4f20778 feat(esp32h21): disable unsupported build test 2025-02-06 15:47:51 +08:00
Christopher Durand c0590f5b50 fix(esp_http_client): Fix invalid content length header
In case a request with no content is sent after one with the content
length header set the header of the previous request is sent with the
subsequent one.
For instance, an empty GET request after a PUT request will still
indicate the non-zero content length of the previous request.

This is fixed by clearing the content length header when it shouldn't be
set.
2025-01-27 12:09:23 +01:00
Mahavir Jain 89a96905c4 fix(esp_https_ota): handle invalid range condition for OTA resumption case 2025-01-23 17:13:43 +05:30
Mahavir Jain d75ca966c3 Merge branch 'fix/revert_and_update_depricated_marked_private_api' into 'master'
fix(esp_http_client): Revert Deprecated Tag on Previously Marked Private API

See merge request espressif/esp-idf!36451
2025-01-21 14:02:19 +08:00
nilesh.kale 783ff22ebf fix(esp_http_client): update code format for API
This commit update code format as per IDF standard for API
esp_http_client_get_and_clear_last_tls_error().
2025-01-21 10:24:33 +05:30
Lorenzo Consolaro 30c2907962 feat(https): Get TLS errors from http client
update PR

update mr

Update components/esp_http_client/esp_http_client.c

Co-authored-by: Nilesh Kale <nilesh.kale@espressif.com>
2025-01-21 10:22:27 +05:30
nilesh.kale f638090179 fix(esp_http_client): Revert Deprecated Tag on Previously Marked Private API
This commit removes depcriacted tag marked on priavte APIs'
http_utils_get_string_between() and http_utils_get_string_after().
As these are not publick API, necessary changes been applied on these
APIs' directly withput adding new similar one and marking them as depricated.
2025-01-16 17:20:27 +05:30
Mahavir Jain 24be422240 Merge branch 'bugfix/missing-esp-goto-on-false-debug' into 'master'
fix: Fixed missing macros declarations in esp_check.h

See merge request espressif/esp-idf!36352
2025-01-16 17:06:37 +08:00
Mahavir Jain dcb43e0eff fix(esp_common): move some DEBUG macros to http client component
In commit a0bcffcc, some ESP_RETURN and ESP_GOTO debug macros were
introduced. But this caused a regression with CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT
case. Its better to move this macros to HTTP client component itself, as
the debug log is still desired for the specific use-case.
2025-01-16 10:27:54 +05:30
Xu Si Yu 4be36fdb8b feat(tcp_transport): add an api to configure the addr family 2025-01-16 10:44:33 +08:00
nilesh.kale d065cc5ce4 fix(esp_http_client): fixed memory leak issue while preparing HTTP digest authentication
This commit avoid memory leak while preparing basic HTTP digest
authentication.
Closes https://github.com/espressif/esp-idf/issues/14885
2024-12-31 15:03:06 +05:30
Mahavir Jain 706a445782 Merge branch 'bugfix/update_macro_defination_for_mem_check' into 'master'
fix(esp_http_client): Enhance MEM_CHECK Macro to Include Memory Allocation Failure Logs and Safe Handling

See merge request espressif/esp-idf!33453
2024-12-23 16:08:57 +08:00
nilesh.kale 92027a9039 fix(esp_http_client): updated API esp_http_client_get_url to get URL in correct format
This commit updates the API to include the port number in the URL,
which was previously missing.
2024-12-18 12:00:55 +05:30
nilesh.kale a0bcffcce9 fix(esp_http_client): updated defination for macro mem_check
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
2024-12-10 15:41:36 +05:30
nilesh.kale 0733de565f feat(esp_htttps_ota): handle case if server retured 304 not_modified during ota
This commit handles case for response code 304 (NOT_MODIFIED) during ota.

Closes https://github.com/espressif/esp-idf/issues/14839
2024-12-02 17:23:30 +08:00
hrushikesh.bhosale 5aaa47834a feat(esp_http_client): Added ALPN feature in esp_http_client
Added the alpn field in esp_http_clinet_config_t struct. So
that user can modify from the esp_http_clinet component.
2024-11-15 14:37:28 +05:30
nilesh.kale 8d8b3fc0a2 fix(esp_http_client): Fix ota failure with openssl server
If the TLS server (e.g., openssl) closes connection with encrypted close-notify alert
then `errno` is not explicitly set on the socket by LwIP stack.
For this scenario, we must rely only on `ERR_TCP_TRANSPORT_CONNECTION_CLOSED_BY_FIN`
return value as the connection close case and do the graceful connection closure.

Closes https://github.com/espressif/esp-idf/issues/14724
2024-10-15 16:37:32 +05:30
nilesh.kale f9961fda62 fix(esp_http_client): added initial argument checking for APIs'
This MR added checks for arguments passed in APIS' of esp_http_client.c
2024-09-27 17:05:04 +05:30
Duco Sebel 73e1085e54 feat(esp_http_client): Add function to delete all headers set by 'esp_http_client_set_header' 2024-09-27 16:57:54 +05:30
Serhii Kulyk c87cb854f3 fix(http): fix invalid content-length header in http get 2024-08-29 00:14:49 +02:00
hrushikesh.bhosale 52cd89698e feat(esp_http_client): Added http method REPORT
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
2024-07-23 16:43:33 +05:30
wanlei 3cf069c7d8 feat(esp32c61): disable unsupported build test 2024-07-16 16:06:19 +08:00