Add UserAgent, remove superfluous form of location mapping.

This commit is contained in:
Fabian Schlenz 2019-11-20 06:17:18 +01:00
parent b989784fb9
commit 710b8a2cdc
1 changed files with 2 additions and 3 deletions

View File

@ -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++) {