Skip to content

Commit ecf7a96

Browse files
committed
http_stream: enable HTTP Basic Auth
We've submitted a PR to Espressif to support enabling HTTP Basic Auth in ESP-ADF's HTTP stream: espressif#1103. Unfortunately we'd also require a change to ESP Audio to support enabling HTTP Basic Auth. As we can't seem to find the ESP Audio source, we'll just enable it unconditionally in ESP-ADF's HTTP stream. ESP Audio uses ESP-ADF's HTTP Stream so this is enough to support HTTP Basic Auth to WIS by using a URL in the form of http://user:[email protected]:19001/. ESP-IDF's http_parser component will detect the username and password in the URL, and esp_http_client will set the Authorization header if the auth type is set to basic, and the parser found a username and password in the URL. If the parser didn't find a username and password, esp_http_client will just skip setting the header entirely, so having auth type hardcoded to basic is not a problem even if users configure a URL without username and password.
1 parent a4c7bbe commit ecf7a96

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

components/audio_stream/http_stream.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ static esp_err_t _http_open(audio_element_handle_t self)
575575
// if not initialize http client, initial it
576576
if (http->client == NULL) {
577577
esp_http_client_config_t http_cfg = {
578+
.auth_type = HTTP_AUTH_TYPE_BASIC,
578579
.url = uri,
579580
.event_handler = _http_event_handle,
580581
.user_data = self,

0 commit comments

Comments
 (0)