summaryrefslogtreecommitdiff
path: root/app/src/insecure/java/se/leap
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2018-02-27 20:48:13 +0100
committercyBerta <cyberta@riseup.net>2018-02-27 20:48:13 +0100
commit69d7e4bc6d77e40407a404606b55630c35a4050b (patch)
treeae032982d0f5354f46927d3fb0f78bc331af5dfb /app/src/insecure/java/se/leap
parente9c52ffc7965c96841f6ae573b19a0a0e9fc7b71 (diff)
parent96bc3f8d14cab11e43fbe6b11dfb6dbf46e5919b (diff)
Merge branch 'origin_0.9.8'0.9.8
Diffstat (limited to 'app/src/insecure/java/se/leap')
-rw-r--r--app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
index 42bd576a..798b6433 100644
--- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
+++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderApiManager.java
@@ -140,7 +140,7 @@ public class ProviderApiManager extends ProviderApiManagerBase {
else
providerDotJsonString = downloadFromApiUrlWithProviderCA("/provider.json", caCert, providerDefinition, dangerOn);
- if (!isValidJson(providerDotJsonString)) {
+ if (ConfigHelper.checkErroneousDownload(providerDotJsonString) || !isValidJson(providerDotJsonString)) {
result.putString(ERRORS, resources.getString(malformed_url));
result.putBoolean(BROADCAST_RESULT_KEY, false);
return result;
@@ -206,9 +206,7 @@ public class ProviderApiManager extends ProviderApiManagerBase {
protected Bundle updateVpnCertificate(Provider provider) {
Bundle result = new Bundle();
try {
- JSONObject providerJson = provider.getDefinition();
- String providerMainUrl = providerJson.getString(Provider.API_URL);
- URL newCertStringUrl = new URL(providerMainUrl + "/" + providerJson.getString(Provider.API_VERSION) + "/" + PROVIDER_VPN_CERTIFICATE);
+ URL newCertStringUrl = new URL(provider.getApiUrlWithVersion() + "/" + PROVIDER_VPN_CERTIFICATE);
String certString = downloadWithProviderCA(provider.getCaCert(), newCertStringUrl.toString(), lastDangerOn);
if (ConfigHelper.checkErroneousDownload(certString)) {
@@ -223,8 +221,7 @@ public class ProviderApiManager extends ProviderApiManagerBase {
}
}
result = loadCertificate(provider, certString);
- } catch (IOException | JSONException e) {
- // TODO try to get Provider Json
+ } catch (IOException e) {
setErrorResult(result, downloading_vpn_certificate_failed, null);
e.printStackTrace();
}