From 710b8a2cdca3184f1e35428caa6ecec6e277b450 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Wed, 20 Nov 2019 06:17:18 +0100 Subject: [PATCH] Add UserAgent, remove superfluous form of location mapping. --- src/data_sources.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/data_sources.cpp b/src/data_sources.cpp index cd6aa45..805cade 100644 --- a/src/data_sources.cpp +++ b/src/data_sources.cpp @@ -50,7 +50,8 @@ HTTPSDataSource::HTTPSDataSource(String url, uint32_t offset) { DEBUG("Connecting to %s...\n", url.c_str()); if (_http) delete _http; _http = new HTTPClient(); - const char* headers[] = {"location"}; + _http->setUserAgent("PodBox 0.1"); + const char* headers[] = {"Location"}; _http->collectHeaders(headers, 1); bool result = _http->begin(url); DEBUG("HTTP->begin result: %d\n", result); @@ -60,8 +61,6 @@ HTTPSDataSource::HTTPSDataSource(String url, uint32_t offset) { if (status == HTTP_CODE_FOUND || status==HTTP_CODE_MOVED_PERMANENTLY || status==HTTP_CODE_TEMPORARY_REDIRECT) { if (_http->hasHeader("Location")) { url = _http->header("Location"); - } else if (_http->hasHeader("location")) { - url = _http->header("location"); } else { ERROR("Got redirection HTTP code, but could not find Location header.\n"); for(int i=0; i<_http->headers(); i++) {