From ba2d64f722f4e0d75cb38eb6d9a93f729607c467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?h=C3=B6rbert?= <55799864+winzkigermany@users.noreply.github.com> Date: Sun, 24 Oct 2021 22:42:36 +0200 Subject: [PATCH] Update http_stream.c Shouldn't we re-get post_len after a redirect, to work with the actual value? --- components/audio_stream/http_stream.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/audio_stream/http_stream.c b/components/audio_stream/http_stream.c index ea62c4cf0..e8a7f8487 100644 --- a/components/audio_stream/http_stream.c +++ b/components/audio_stream/http_stream.c @@ -388,8 +388,9 @@ static esp_err_t _http_open(audio_element_handle_t self) } char *buffer = NULL; - int post_len = esp_http_client_get_post_field(http->client, &buffer); + int post_len = 0; _stream_redirect: + post_len = esp_http_client_get_post_field(http->client, &buffer); if ((err = esp_http_client_open(http->client, post_len)) != ESP_OK) { ESP_LOGE(TAG, "Failed to open http stream"); return err; @@ -706,8 +707,9 @@ esp_err_t http_stream_auto_connect_next_track(audio_element_handle_t el) if (track) { esp_http_client_set_url(http->client, track); char *buffer = NULL; - int post_len = esp_http_client_get_post_field(http->client, &buffer); + int post_len = 0; redirection: + post_len = esp_http_client_get_post_field(http->client, &buffer); if ((esp_http_client_open(http->client, post_len)) != ESP_OK) { ESP_LOGE(TAG, "Failed to open http stream"); return ESP_FAIL;