HttpRequest: handle 302 and 307 redirects.

* Makes jamendo.com player work, as their soundfiles are behind a
temporary redirect for load balancing.
This commit is contained in:
Adrien Destugues 2014-04-09 14:01:13 +02:00
parent d946ade025
commit a8d8e823ea
1 changed files with 5 additions and 2 deletions

View File

@ -321,8 +321,11 @@ BHttpRequest::_ProtocolLoop()
break; break;
// TODO: Some browsers seems to translate POST requests to // TODO: Some browsers seems to translate POST requests to
// GET when following a 302 redirection // GET when following a 302 redirection. 303 should do the same,
if (fResult.StatusCode() == B_HTTP_STATUS_MOVED_PERMANENTLY) { // but NOT 307.
if (fResult.StatusCode() == B_HTTP_STATUS_MOVED_PERMANENTLY
|| fResult.StatusCode() == B_HTTP_STATUS_TEMPORARY_REDIRECT
|| fResult.StatusCode() == B_HTTP_STATUS_FOUND) {
BString locationUrl = fHeaders["Location"]; BString locationUrl = fHeaders["Location"];
fUrl = BUrl(fUrl, locationUrl); fUrl = BUrl(fUrl, locationUrl);