1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-24 21:32:07 +01:00

Use NetCipher.getHttpsUrlConnection in GetPodsService

This commit is contained in:
vanitasvitae 2016-06-06 12:00:19 +02:00
parent 68d7bdaa40
commit 53e65eb756

View file

@ -44,6 +44,10 @@ import java.io.InputStreamReader;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.net.ssl.HttpsURLConnection;
import info.guardianproject.netcipher.NetCipher;
public class GetPodsService extends Service { public class GetPodsService extends Service {
public static final String MESSAGE_PODS_RECEIVED = "com.github.dfa.diaspora.podsreceived"; public static final String MESSAGE_PODS_RECEIVED = "com.github.dfa.diaspora.podsreceived";
private static final String TAG = App.TAG; private static final String TAG = App.TAG;
@ -73,16 +77,13 @@ public class GetPodsService extends Service {
// TODO: Update deprecated code // TODO: Update deprecated code
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
HttpClient client = new DefaultHttpClient(); //HttpClient client = new DefaultHttpClient();
List<String> list = null; List<String> list = null;
try { try {
HttpGet httpGet = new HttpGet("http://podupti.me/api.php?key=4r45tg&format=json"); HttpsURLConnection connection = NetCipher.getHttpsURLConnection("http://podupti.me/api.php?key=4r45tg&format=json");
HttpResponse response = client.execute(httpGet); int statusCode = connection.getResponseCode();
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusCode == 200) { if (statusCode == 200) {
HttpEntity entity = response.getEntity(); InputStream content = connection.getInputStream();
InputStream content = entity.getContent();
BufferedReader reader = new BufferedReader( BufferedReader reader = new BufferedReader(
new InputStreamReader(content)); new InputStreamReader(content));
String line; String line;