mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-01-18 23:17:59 +01:00
Remove follow redirects hack
If we really reach a 302 code in (a)syncRequest this is due not being given a Location header by the server. This is not an expected behaviour but an actual error state.
This commit is contained in:
parent
a3f5a6c98d
commit
4e9a088af4
@ -268,15 +268,6 @@ Tomahawk.syncRequest = function (url, extraHeaders, options) {
|
||||
xmlHttpRequest.send(null);
|
||||
if (xmlHttpRequest.status == 200) {
|
||||
return xmlHttpRequest.responseText;
|
||||
} else if (xmlHttpRequest.status == 302) {
|
||||
// You know that XMLHttpRequest always follows redirects?
|
||||
// Guess what: It does not always.
|
||||
//
|
||||
// Known:
|
||||
// * If you are redirect to a different domain in QtWebkit on MacOS,
|
||||
// you will have to deal with 302.
|
||||
Tomahawk.syncRequest(xmlHttpRequest.getResponseHeader('Location'),
|
||||
extraHeaders, options);
|
||||
} else {
|
||||
Tomahawk.log("Failed to do GET request: to: " + url);
|
||||
Tomahawk.log("Status Code was: " + xmlHttpRequest.status);
|
||||
@ -309,15 +300,6 @@ Tomahawk.asyncRequest = function (url, callback, extraHeaders, options) {
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 200) {
|
||||
callback.call(window, xmlHttpRequest);
|
||||
} else if (xmlHttpRequest.readyState == 4 && xmlHttpRequest.status == 302) {
|
||||
// You know that XMLHttpRequest always follows redirects?
|
||||
// Guess what: It does not always.
|
||||
//
|
||||
// Known:
|
||||
// * If you are redirect to a different domain in QtWebkit on MacOS,
|
||||
// you will have to deal with 302.
|
||||
Tomahawk.asyncRequest(xmlHttpRequest.getResponseHeader('Location'),
|
||||
callback, extraHeaders, options);
|
||||
} else if (xmlHttpRequest.readyState === 4) {
|
||||
Tomahawk.log("Failed to do " + method + " request: to: " + url);
|
||||
Tomahawk.log("Status Code was: " + xmlHttpRequest.status);
|
||||
|
Loading…
x
Reference in New Issue
Block a user