From 0265da4ae61286b8137185108bdd10a1cde51931 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 24 Dec 2015 14:55:33 +0100 Subject: [PATCH] use HttpsURLConnections since youtube.com always uses HTTPS This helps enforce that the connection is encrypted. If for whatever reason an unencrypted connection is created, an Exception will be thrown. --- app/src/main/java/org/schabi/newpipe/Downloader.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/Downloader.java b/app/src/main/java/org/schabi/newpipe/Downloader.java index c15c2ddc3..9e33ce322 100644 --- a/app/src/main/java/org/schabi/newpipe/Downloader.java +++ b/app/src/main/java/org/schabi/newpipe/Downloader.java @@ -7,6 +7,8 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; +import javax.net.ssl.HttpsURLConnection; + import info.guardianproject.netcipher.NetCipher; /** @@ -43,7 +45,7 @@ public class Downloader { String ret = ""; try { URL url = new URL(siteUrl); - HttpURLConnection con = (HttpURLConnection) NetCipher.getHttpURLConnection(url); + HttpsURLConnection con = NetCipher.getHttpsURLConnection(url); con.setRequestProperty("Accept-Language", language); ret = dl(con); } @@ -88,7 +90,7 @@ public class Downloader { try { URL url = new URL(siteUrl); - HttpURLConnection con = (HttpURLConnection) NetCipher.getHttpURLConnection(url); + HttpsURLConnection con = NetCipher.getHttpsURLConnection(url); ret = dl(con); } catch(Exception e) {