1
0
mirror of https://github.com/ultrasonic/ultrasonic synced 2025-02-19 13:10:54 +01:00

Incorporate fix from d7c91c48c7

This commit is contained in:
Joshua Bahnsen 2013-02-22 20:04:57 -07:00
parent 8d4bf5d4b0
commit f25f1da3ec

View File

@ -744,7 +744,14 @@ public class RESTMusicService implements MusicService {
private void detectRedirect(String originalUrl, Context context, HttpContext httpContext) {
HttpUriRequest request = (HttpUriRequest) httpContext.getAttribute(ExecutionContext.HTTP_REQUEST);
HttpHost host = (HttpHost) httpContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
String redirectedUrl = host.toURI() + request.getURI();
// Sometimes the request doesn't contain the "http://host" part
String redirectedUrl;
if (request.getURI().getScheme() == null) {
redirectedUrl = host.toURI() + request.getURI();
} else {
redirectedUrl = request.getURI().toString();
}
redirectFrom = originalUrl.substring(0, originalUrl.indexOf("/rest/"));
redirectTo = redirectedUrl.substring(0, redirectedUrl.indexOf("/rest/"));