diff options
Diffstat (limited to 'src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt')
-rw-r--r-- | src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt b/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt index 757c32c..f538458 100644 --- a/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt +++ b/src/main/kotlin/xyz/brysonsteck/ServerCraft/server/Download.kt @@ -3,6 +3,7 @@ package xyz.brysonsteck.ServerCraft.server import java.io.*; import java.net.*; import java.util.*; +import javax.net.ssl.HttpsURLConnection class Download: Runnable { public enum class Status { @@ -43,7 +44,7 @@ class Download: Runnable { try { // Open connection to URL. - var connection = url.openConnection() as HttpURLConnection; + var connection = url.openConnection() as HttpsURLConnection; // Specify what portion of file to download. connection.setRequestProperty("Range", "bytes=" + downloaded + "-"); @@ -53,12 +54,14 @@ class Download: Runnable { // Make sure response code is in the 200 range. if (connection.responseCode / 100 != 2) { + println(connection.responseCode) status = Status.ERROR } // Check for valid content length. contentLength = connection.getContentLength(); if (contentLength < 1) { + println(connection.getContentLength()) status = Status.ERROR } @@ -99,6 +102,7 @@ class Download: Runnable { status = Status.COMPLETE; } } catch (e: Exception) { + println(e) status = Status.ERROR } finally { // Close file. |