fix: add TLS certificate bundle for HTTPS connections
All HTTP clients (Telegram, Claude API, OTA) were missing crt_bundle_attach, causing TLS handshake failures. Add esp-tls dependency to CMakeLists. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,5 +16,5 @@ idf_component_register(
|
|||||||
"."
|
"."
|
||||||
REQUIRES
|
REQUIRES
|
||||||
nvs_flash esp_wifi esp_netif esp_http_client esp_http_server
|
nvs_flash esp_wifi esp_netif esp_http_client esp_http_server
|
||||||
esp_https_ota esp_event json spiffs console vfs app_update
|
esp_https_ota esp_event json spiffs console vfs app_update esp-tls
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_http_client.h"
|
#include "esp_http_client.h"
|
||||||
|
#include "esp_crt_bundle.h"
|
||||||
#include "nvs.h"
|
#include "nvs.h"
|
||||||
#include "cJSON.h"
|
#include "cJSON.h"
|
||||||
|
|
||||||
@@ -188,6 +189,7 @@ esp_err_t llm_chat(const char *system_prompt, const char *messages_json,
|
|||||||
.timeout_ms = 120 * 1000, /* 2 min timeout for long responses */
|
.timeout_ms = 120 * 1000, /* 2 min timeout for long responses */
|
||||||
.buffer_size = 4096,
|
.buffer_size = 4096,
|
||||||
.buffer_size_tx = 4096,
|
.buffer_size_tx = 4096,
|
||||||
|
.crt_bundle_attach = esp_crt_bundle_attach,
|
||||||
};
|
};
|
||||||
|
|
||||||
esp_http_client_handle_t client = esp_http_client_init(&config);
|
esp_http_client_handle_t client = esp_http_client_init(&config);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_ota_ops.h"
|
#include "esp_ota_ops.h"
|
||||||
#include "esp_http_client.h"
|
#include "esp_http_client.h"
|
||||||
|
#include "esp_crt_bundle.h"
|
||||||
#include "esp_https_ota.h"
|
#include "esp_https_ota.h"
|
||||||
|
|
||||||
static const char *TAG = "ota";
|
static const char *TAG = "ota";
|
||||||
@@ -15,6 +16,7 @@ esp_err_t ota_update_from_url(const char *url)
|
|||||||
.url = url,
|
.url = url,
|
||||||
.timeout_ms = 120000,
|
.timeout_ms = 120000,
|
||||||
.buffer_size = 4096,
|
.buffer_size = 4096,
|
||||||
|
.crt_bundle_attach = esp_crt_bundle_attach,
|
||||||
};
|
};
|
||||||
|
|
||||||
esp_https_ota_config_t ota_config = {
|
esp_https_ota_config_t ota_config = {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_http_client.h"
|
#include "esp_http_client.h"
|
||||||
|
#include "esp_crt_bundle.h"
|
||||||
#include "nvs.h"
|
#include "nvs.h"
|
||||||
#include "cJSON.h"
|
#include "cJSON.h"
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ static char *tg_api_call(const char *method, const char *post_data)
|
|||||||
.timeout_ms = (MIMI_TG_POLL_TIMEOUT_S + 5) * 1000,
|
.timeout_ms = (MIMI_TG_POLL_TIMEOUT_S + 5) * 1000,
|
||||||
.buffer_size = 2048,
|
.buffer_size = 2048,
|
||||||
.buffer_size_tx = 2048,
|
.buffer_size_tx = 2048,
|
||||||
|
.crt_bundle_attach = esp_crt_bundle_attach,
|
||||||
};
|
};
|
||||||
|
|
||||||
esp_http_client_handle_t client = esp_http_client_init(&config);
|
esp_http_client_handle_t client = esp_http_client_init(&config);
|
||||||
|
|||||||
Reference in New Issue
Block a user