1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-09-29 23:40:49 +00:00

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.
This commit is contained in:
Hans-Christoph Steiner 2015-12-24 14:55:33 +01:00
parent ef255d12ae
commit 0265da4ae6

View File

@ -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) {