OpenDelta: Download: Match HTTP response with expectation

This commit is contained in:
Ido Ben-Hur 2022-12-08 21:02:59 +02:00
parent 10a91b3321
commit c3829a8d79
No known key found for this signature in database
GPG Key ID: 0B827201D8C20BFE
1 changed files with 8 additions and 3 deletions

View File

@ -308,9 +308,14 @@ public class Download {
urlConnection.setRequestProperty("Range", "bytes=" + offset + "-"); urlConnection.setRequestProperty("Range", "bytes=" + offset + "-");
urlConnection.connect(); urlConnection.connect();
int code = urlConnection.getResponseCode(); int code = urlConnection.getResponseCode();
if (code != HttpsURLConnection.HTTP_OK if (offset > 0 && code != HttpsURLConnection.HTTP_PARTIAL) {
&& code != HttpsURLConnection.HTTP_PARTIAL) { Logger.d("response: %d expected: %d", code,
Logger.d("response: %d", code); HttpsURLConnection.HTTP_PARTIAL);
return null;
}
if (offset == 0 && code != HttpsURLConnection.HTTP_OK) {
Logger.d("response: %d expected: %d", code,
HttpsURLConnection.HTTP_OK);
return null; return null;
} }
return urlConnection; return urlConnection;