also set Read Timeout with mirror logic timeout value

The Read Timeout makes a SocketTimeoutException be thrown if the timeout
expires before data is available for reading from the connection's
returned InputStream.  This should help the client switch to a new mirror
when the current mirror is too slow or overloaded.
This commit is contained in:
Hans-Christoph Steiner 2019-02-13 12:38:13 +01:00
parent 8f854c2c6e
commit 66ac4bcec3

View File

@ -176,6 +176,7 @@ public class HttpDownloader extends Downloader {
connection.setRequestProperty("User-Agent", "F-Droid " + BuildConfig.VERSION_NAME);
connection.setConnectTimeout(getTimeout());
connection.setReadTimeout(getTimeout());
if (Build.VERSION.SDK_INT < 19) { // gzip encoding can be troublesome on old Androids
connection.setRequestProperty("Accept-Encoding", "identity");