From a8d8e823ea0b5ad0716d028ee43381a0c4691664 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 9 Apr 2014 14:01:13 +0200 Subject: [PATCH] HttpRequest: handle 302 and 307 redirects. * Makes jamendo.com player work, as their soundfiles are behind a temporary redirect for load balancing. --- src/kits/network/libnetapi/HttpRequest.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kits/network/libnetapi/HttpRequest.cpp b/src/kits/network/libnetapi/HttpRequest.cpp index fdb44694a7..d342b7b777 100644 --- a/src/kits/network/libnetapi/HttpRequest.cpp +++ b/src/kits/network/libnetapi/HttpRequest.cpp @@ -321,8 +321,11 @@ BHttpRequest::_ProtocolLoop() break; // TODO: Some browsers seems to translate POST requests to - // GET when following a 302 redirection - if (fResult.StatusCode() == B_HTTP_STATUS_MOVED_PERMANENTLY) { + // GET when following a 302 redirection. 303 should do the same, + // 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"]; fUrl = BUrl(fUrl, locationUrl);