Add UserAgent, remove superfluous form of location mapping.
This commit is contained in:
parent
b989784fb9
commit
710b8a2cdc
@ -50,7 +50,8 @@ HTTPSDataSource::HTTPSDataSource(String url, uint32_t offset) {
|
|||||||
DEBUG("Connecting to %s...\n", url.c_str());
|
DEBUG("Connecting to %s...\n", url.c_str());
|
||||||
if (_http) delete _http;
|
if (_http) delete _http;
|
||||||
_http = new HTTPClient();
|
_http = new HTTPClient();
|
||||||
const char* headers[] = {"location"};
|
_http->setUserAgent("PodBox 0.1");
|
||||||
|
const char* headers[] = {"Location"};
|
||||||
_http->collectHeaders(headers, 1);
|
_http->collectHeaders(headers, 1);
|
||||||
bool result = _http->begin(url);
|
bool result = _http->begin(url);
|
||||||
DEBUG("HTTP->begin result: %d\n", result);
|
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 (status == HTTP_CODE_FOUND || status==HTTP_CODE_MOVED_PERMANENTLY || status==HTTP_CODE_TEMPORARY_REDIRECT) {
|
||||||
if (_http->hasHeader("Location")) {
|
if (_http->hasHeader("Location")) {
|
||||||
url = _http->header("Location");
|
url = _http->header("Location");
|
||||||
} else if (_http->hasHeader("location")) {
|
|
||||||
url = _http->header("location");
|
|
||||||
} else {
|
} else {
|
||||||
ERROR("Got redirection HTTP code, but could not find Location header.\n");
|
ERROR("Got redirection HTTP code, but could not find Location header.\n");
|
||||||
for(int i=0; i<_http->headers(); i++) {
|
for(int i=0; i<_http->headers(); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user