mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 03:57:07 +03:00
simplify artwork and bypass server certificate verification
This commit is contained in:
@@ -533,7 +533,8 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y
|
||||
# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set
|
||||
# CONFIG_ESP_TLS_SERVER is not set
|
||||
# CONFIG_ESP_TLS_PSK_VERIFICATION is not set
|
||||
# CONFIG_ESP_TLS_INSECURE is not set
|
||||
CONFIG_ESP_TLS_INSECURE=y
|
||||
CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=y
|
||||
# end of ESP-TLS
|
||||
|
||||
#
|
||||
@@ -727,7 +728,7 @@ CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
|
||||
#
|
||||
# ESP HTTP client
|
||||
#
|
||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set
|
||||
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS
|
||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
|
||||
# end of ESP HTTP client
|
||||
|
||||
|
||||
@@ -505,7 +505,8 @@ CONFIG_ESP_TLS_USING_MBEDTLS=y
|
||||
# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set
|
||||
# CONFIG_ESP_TLS_SERVER is not set
|
||||
# CONFIG_ESP_TLS_PSK_VERIFICATION is not set
|
||||
# CONFIG_ESP_TLS_INSECURE is not set
|
||||
CONFIG_ESP_TLS_INSECURE=y
|
||||
CONFIG_ESP_TLS_SKIP_SERVER_CERT_VERIFY=y
|
||||
# end of ESP-TLS
|
||||
|
||||
#
|
||||
@@ -699,7 +700,7 @@ CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
|
||||
#
|
||||
# ESP HTTP client
|
||||
#
|
||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS is not set
|
||||
CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS
|
||||
# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
|
||||
# end of ESP HTTP client
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ typedef struct {
|
||||
size_t max, bytes;
|
||||
bool abort;
|
||||
uint8_t *data;
|
||||
char *url;
|
||||
esp_http_client_handle_t client;
|
||||
} http_context_t;
|
||||
|
||||
static void http_downloader(void *arg);
|
||||
@@ -194,32 +194,30 @@ static esp_err_t http_event_handler(esp_http_client_event_t *evt);
|
||||
|
||||
void http_download(char *url, size_t max, http_download_cb_t callback, void *context) {
|
||||
http_context_t *http_context = (http_context_t*) heap_caps_calloc(sizeof(http_context_t), 1, MALLOC_CAP_SPIRAM);
|
||||
|
||||
http_context->callback = callback;
|
||||
http_context->user_context = context;
|
||||
http_context->max = max;
|
||||
http_context->url = strdup(url);
|
||||
|
||||
xTaskCreate(http_downloader, "downloader", 4*1024, http_context, ESP_TASK_PRIO_MIN + 1, NULL);
|
||||
}
|
||||
|
||||
static void http_downloader(void *arg) {
|
||||
http_context_t *http_context = (http_context_t*) arg;
|
||||
esp_http_client_config_t config = {
|
||||
.url = http_context->url,
|
||||
.url = url,
|
||||
.event_handler = http_event_handler,
|
||||
.user_data = http_context,
|
||||
//.cert_pem = howsmyssl_com_root_cert_pem_start,
|
||||
//.skip_cert_common_name_check = true,
|
||||
};
|
||||
|
||||
esp_http_client_handle_t client = esp_http_client_init(&config);
|
||||
esp_http_client_perform(client);
|
||||
// esp_http_client_cleanup(client);
|
||||
http_context->callback = callback;
|
||||
http_context->user_context = context;
|
||||
http_context->max = max;
|
||||
http_context->client = esp_http_client_init(&config);
|
||||
|
||||
xTaskCreate(http_downloader, "downloader", 4*1024, http_context, ESP_TASK_PRIO_MIN + 1, NULL);
|
||||
}
|
||||
|
||||
static void http_downloader(void *arg) {
|
||||
http_context_t *http_context = (http_context_t*) arg;
|
||||
|
||||
esp_http_client_perform(http_context->client);
|
||||
esp_http_client_cleanup(http_context->client);
|
||||
|
||||
free(http_context->url);
|
||||
free(http_context);
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user