diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-10-18 11:28:41 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-10-18 13:06:54 +0200 |
commit | db9397fd3ec3254db21e34fb58776b8808182ef7 (patch) | |
tree | d3e940ec1ca7c67c8df6ce0ec9768f7f0b4d8336 /app/src/main/java/com/wireguard/android/util/ModuleLoader.java | |
parent | Suppress depreciation warnings (diff) | |
download | wireguard-android-db9397fd3ec3254db21e34fb58776b8808182ef7.tar.xz wireguard-android-db9397fd3ec3254db21e34fb58776b8808182ef7.zip |
Application: put user agent in log to help debugging
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/com/wireguard/android/util/ModuleLoader.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/app/src/main/java/com/wireguard/android/util/ModuleLoader.java b/app/src/main/java/com/wireguard/android/util/ModuleLoader.java index 21ff9c77..524d10a6 100644 --- a/app/src/main/java/com/wireguard/android/util/ModuleLoader.java +++ b/app/src/main/java/com/wireguard/android/util/ModuleLoader.java @@ -10,7 +10,6 @@ import android.system.OsConstants; import android.util.Base64; import com.wireguard.android.Application; -import com.wireguard.android.BuildConfig; import com.wireguard.android.util.RootShell.NoRootException; import net.i2p.crypto.eddsa.EdDSAEngine; @@ -130,10 +129,8 @@ public class ModuleLoader { if (output.size() != 1 || output.get(0).length() != 64) throw new InvalidParameterException("Invalid sha256 of /proc/version"); final String moduleName = String.format(MODULE_NAME, output.get(0)); - final String userAgent = String.format("WireGuard/%s (Android)", BuildConfig.VERSION_NAME); //TODO: expand a bit - HttpURLConnection connection = (HttpURLConnection)new URL(MODULE_LIST_URL).openConnection(); - connection.setRequestProperty("User-Agent", userAgent); + connection.setRequestProperty("User-Agent", Application.USER_AGENT); connection.connect(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) throw new IOException("Hash list could not be found"); @@ -150,7 +147,7 @@ public class ModuleLoader { if (!modules.containsKey(moduleName)) return OsConstants.ENOENT; connection = (HttpURLConnection)new URL(String.format(MODULE_URL, moduleName)).openConnection(); - connection.setRequestProperty("User-Agent", userAgent); + connection.setRequestProperty("User-Agent", Application.USER_AGENT); connection.connect(); if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) throw new IOException("Module file could not be found, despite being on hash list"); |