This also needs to handle mirror lists with 1 element, since mirrors can
now be disabled. If the user disables all mirrors, then there will be only one URL in the
list of mirrors. Asking for a random mirror in that case should not return
null, but the one enabled mirror.
closes#1696
```python
import glob
for f in glob.glob('metadata/*/*.txt'):
with open(f) as fp:
data = fp.read()
with open(f, 'w') as fp:
fp.write(data.rstrip())
fp.write('\n')
```
for f in metadata/*/short_description.txt; do data=`cat $f`; echo $data > $f; done
This spreads downloads across all available mirrors randomly. This could
definitely be improved, like choosing the fastest or nearest mirror, or
only .onion addresses on Tor. This will improve the current situation and
should reduce the load on f-droid.org a lot.
fdroidclient#1696
Remove unused code and simplify to only present args that are used. This is
remnants from:
fdroidclient#490
fdroidclient#606
fdroidclient!295
fdroidclient!242
Lots of people complain that the graphics aren't being downloaded. That's
because they never use F-Droid while on WiFi and the default prefs do not
allow downloading graphics while on Data. This sets the preference to
allow downloading graphics while on Data if only Data is enabled, and not
WiFi, when the user first starts F-Droid.
closes#1592
This makes it display nicely in RepoDetails, and is natural, since it is
the canonical URL. This also maintains the order as received from the
mirror entries in the index file.
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 should make the timeout logic clearer, without changing the logic at
all. This does increase the timeouts, with the second pass using 1 minute
instead of 30 seconds, and the third pass using 10 minutes instead of 1
minute. Since this often or usually runs in the background, it should
allow some pretty long timeouts in the worst case.
It seems that ARM emulators timeout even when just trying to run the
assumeTrue() tests via Espresso. There needs to be one test still enabled
in the file, otherwise, the run fails with:
org.fdroid.fdroid.MainActivityEspressoTest > initializationError[Nexus_One_API_19(AVD) - 4.4.2] FAILED
java.lang.Exception: No runnable methods
at org.junit.runners.BlockJUnit4ClassRunner.validateInstanceMethods(BlockJUnit4ClassRunner.java:191)
The two excluded URLs seem to always resolve to IPv6 addresses first, then
fail since there isn't IPv6 connectivity. Donno why, but only on old android
versions, so just skip them there.
Compression seems to just give stacktraces:
HttpDownloaderTest I URL: https://en.wikipedia.org/wiki/Index.html
TestRunner I failed: downloadUninterruptedTest(org.fdroid.fdroid.net.HttpDownloaderTest)
I ----- begin exception -----
I java.io.EOFException
I at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:206)
I at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:98)
I at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
I at libcore.net.http.HttpEngine.initContentStream(HttpEngine.java:541)
I at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:844)
I at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
I at libcore.net.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:139)
I at libcore.net.http.HttpsURLConnectionImpl.getHeaderField(HttpsURLConnectionImpl.java:246)
I at org.fdroid.fdroid.net.HttpDownloader.download(HttpDownloader.java:111)
I at org.fdroid.fdroid.net.HttpDownloaderTest.downloadUninterruptedTest(HttpDownloaderTest.java:74)
I at java.lang.reflect.Method.invokeNative(Native Method)
I at java.lang.reflect.Method.invoke(Method.java:511)
I at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
I at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
I at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
I at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
I at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
I at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
I at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
I at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
I at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
I at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
I at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
I at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
I at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
I at org.junit.runners.Suite.runChild(Suite.java:128)
I at org.junit.runners.Suite.runChild(Suite.java:27)
I at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
I at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
I at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
I at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
I at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
I at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
I at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
I at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
I at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:56)
I at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:384)
I at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1661)