From a0602c7759572c4af8947688132f8f7e97fb1563 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 3 Mar 2015 18:17:04 -0800 Subject: #320 Update with WebProxy using our custom httpClient (so we can bypass self-signed certs) --- src/github/daneren2005/dsub/service/ChromeCastController.java | 2 +- src/github/daneren2005/dsub/service/DLNAController.java | 2 +- src/github/daneren2005/dsub/service/RESTMusicService.java | 5 +++++ src/github/daneren2005/dsub/service/RemoteController.java | 10 ++++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src/github/daneren2005') diff --git a/src/github/daneren2005/dsub/service/ChromeCastController.java b/src/github/daneren2005/dsub/service/ChromeCastController.java index 21ee6e13..a729ed4e 100644 --- a/src/github/daneren2005/dsub/service/ChromeCastController.java +++ b/src/github/daneren2005/dsub/service/ChromeCastController.java @@ -288,7 +288,7 @@ public class ChromeCastController extends RemoteController { } if(proxy == null) { - proxy = new WebProxy(downloadService); + proxy = createWebProxy(); proxy.start(); } } else if(proxy != null) { diff --git a/src/github/daneren2005/dsub/service/DLNAController.java b/src/github/daneren2005/dsub/service/DLNAController.java index a2894a23..701034de 100644 --- a/src/github/daneren2005/dsub/service/DLNAController.java +++ b/src/github/daneren2005/dsub/service/DLNAController.java @@ -398,7 +398,7 @@ public class DLNAController extends RemoteController { } if(proxy == null) { - proxy = new WebProxy(downloadService); + proxy = createWebProxy(); proxy.start(); } } else if(proxy != null) { diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index 341b1158..307afc9a 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -39,6 +39,7 @@ import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; @@ -1878,4 +1879,8 @@ public class RESTMusicService implements MusicService { return Util.getRestUrl(context, method, instance, allowAltAddress); } } + + public HttpClient getHttpClient() { + return httpClient; + } } diff --git a/src/github/daneren2005/dsub/service/RemoteController.java b/src/github/daneren2005/dsub/service/RemoteController.java index 02deaf85..47730e8c 100644 --- a/src/github/daneren2005/dsub/service/RemoteController.java +++ b/src/github/daneren2005/dsub/service/RemoteController.java @@ -32,6 +32,7 @@ import java.util.concurrent.LinkedBlockingQueue; import github.daneren2005.dsub.R; import github.daneren2005.dsub.domain.RemoteStatus; +import github.daneren2005.serverproxy.WebProxy; public abstract class RemoteController { private static final String TAG = RemoteController.class.getSimpleName(); @@ -95,4 +96,13 @@ public abstract class RemoteController { queue.clear(); } } + + protected WebProxy createWebProxy() { + MusicService musicService = MusicServiceFactory.getMusicService(downloadService); + if(musicService instanceof RESTMusicService) { + return new WebProxy(downloadService, ((RESTMusicService)musicService).getHttpClient()); + } else { + return new WebProxy(downloadService); + } + } } -- cgit v1.2.3