Commit d673480a authored by Szabolcs Gyurko's avatar Szabolcs Gyurko
Browse files

Added a more robust checking for Ranges

parent c11e1706
......@@ -39,7 +39,7 @@ class HttpWorker (override protected val downloadJob: DownloadJob,
try {
method.addHeader("Connection", "close")
method.addHeader("Range", "")
method.addHeader("Range", "bytes=0-")
if (downloadJob.username.nonEmpty && downloadJob.password.nonEmpty) {
val credentialsProvider = new BasicCredentialsProvider()
......@@ -52,7 +52,7 @@ class HttpWorker (override protected val downloadJob: DownloadJob,
val httpResponse = httpClient.execute(method)
val contentLengthHeader = httpResponse.getFirstHeader("Content-Length")
val acceptRangesHeader = httpResponse.getFirstHeader("Accept-Ranges")
if (httpResponse.getStatusLine.getStatusCode == 200 && contentLengthHeader != null && acceptRangesHeader != null) {
if (((httpResponse.getStatusLine.getStatusCode == 200 && acceptRangesHeader != null) || httpResponse.getStatusLine.getStatusCode == 206) && contentLengthHeader != null) {
contentLengthHeader.getValue.toLong
} else {
if (acceptRangesHeader == null) Logger.warn("Server does not support ranges. Reporting zero size for the artifact, thus making the transfer fail.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment