diff --git a/components/audio_stream/http_stream.c b/components/audio_stream/http_stream.c index 8c02974bc..4dd67af10 100644 --- a/components/audio_stream/http_stream.c +++ b/components/audio_stream/http_stream.c @@ -97,6 +97,7 @@ typedef struct http_stream { gzip_miniz_handle_t gzip; /* GZIP instance */ http_stream_hls_key_t *hls_key; hls_handle_t *hls_media; + const char *user_agent; } http_stream_t; static esp_err_t http_stream_auto_connect_next_track(audio_element_handle_t el); @@ -467,6 +468,7 @@ static esp_err_t _http_open(audio_element_handle_t self) #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) && defined CONFIG_MBEDTLS_CERTIFICATE_BUNDLE .crt_bundle_attach = http->crt_bundle_attach, #endif // (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) && defined CONFIG_MBEDTLS_CERTIFICATE_BUNDLE + .user_agent = http->user_agent, }; http->client = esp_http_client_init(&http_cfg); AUDIO_MEM_CHECK(TAG, http->client, return ESP_ERR_NO_MEM); @@ -808,6 +810,7 @@ audio_element_handle_t http_stream_init(http_stream_cfg_t *config) http->stream_type = config->type; http->user_data = config->user_data; http->cert_pem = config->cert_pem; + http->user_agent = config->user_agent; if (config->crt_bundle_attach) { #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) diff --git a/components/audio_stream/include/http_stream.h b/components/audio_stream/include/http_stream.h index 6acab01cd..bf88276db 100644 --- a/components/audio_stream/include/http_stream.h +++ b/components/audio_stream/include/http_stream.h @@ -88,6 +88,7 @@ typedef struct { const char *cert_pem; /*!< SSL server certification, PEM format as string, if the client requires to verify server */ esp_err_t (*crt_bundle_attach)(void *conf); /*!< Function pointer to esp_crt_bundle_attach. Enables the use of certification bundle for server verification, must be enabled in menuconfig */ + const char *user_agent; } http_stream_cfg_t; @@ -110,6 +111,7 @@ typedef struct { .multi_out_num = 0, \ .cert_pem = NULL, \ .crt_bundle_attach = NULL, \ + .user_agent = NULL, \ } /**