novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

HTTP errors are overridden with WaitingForNetwork status #458

Closed Lingviston closed 5 years ago

Lingviston commented 6 years ago

Steps to reproduce:

  1. Install simple app;
  2. Connect device through proxy and override http status of the response to any of the files which is going to be downloaded to 404 (for example);
  3. Start downloading.

Expected: Once file for which the response code has been overridden starts downloading it fails with Error status. Actual: Once file for which the response code has been overridden starts downloading it fails with WaitingForNetwork status.

This issue also leads to network recovery mechanism being applied whenever download fails not due to the lack of connection.

It also doesn't allow to implement different client logic based on the reason of a failure as it is unclear if it is a network issue or a backend one. For example remove download from queue if backend error happens and retry if network connection is missing. Both scenarios will lead to WaitingForNetwork state, which doesn't let distinguish between them.

Mecharyry commented 5 years ago

Collapsing this into #483. This requires more careful analysis.