Daniel Martí d7a30b4c34 Merge branch 'fix-430--download-without-content-length' into 'master'
Ddownload index, even when not presented with a Content-Length header (Fixes 430)

This works for the index download, but still does not work for downloading .apks correctly. That is, the Android Download Manager needs one of:

 * `Content-Length: ...`
 * `Connection: close`
 * `Transfer-Encoding: Chunked`

headers to be set to work correctly. In the absence of all three of these, problems ensue. In fact in my toy web server, even the `Connection: close` did not seem to work correctly, but I'd be happy to be corrected on that. Either way, this is an improvement on what was there before.

For reference, here is my toy PHP web server, which can be saved in the root of the F-Droid repo and invoked with:

> `php -S 10.0.0.4:8888 no-headers.php`

```
<?php

function streamFile( $file ) { $size     = filesize( $file );
        $contents = file_get_contents( $file );

        $buffer = (int)( $size / 5 );
        $bytes = 0;
        while ( $bytes < $size ) {
                $toStream = min( $size - $bytes, $buffer );
                echo substr( $contents, $bytes, $toStream );
                $bytes += $toStream;

                // Sleep to allow progress to be viewed in F-Droid
                sleep( 1 );
        }
}

$index    = "/fdroid/repo/index.jar";
$firefox  = "/fdroid/repo/fennec-40.0.multi.android-arm.apk";

// Test downloading a large .apk to see how it behaves
if ( $_SERVER['REQUEST_URI'] == "/fdroid/repo/fennec-40.0.multi.android-arm.apk" ) {
        $file = $firefox;
} else {
        $file = $index;
}

// Android Download Manager requires this (if not using Content-Length or Transfer-Encoding
// headers, but I can't seem to get it to work as expected).
header( "Connection: Close" );
streamFile( dirname( __FILE__ ) . $file );

```

See merge request !150
2015-10-04 15:00:07 +00:00
2015-09-25 22:00:24 -07:00
2015-09-25 22:00:24 -07:00
2015-09-09 21:24:36 -07:00
2015-06-16 20:05:55 +02:00
2015-09-25 22:00:24 -07:00
2015-09-30 11:50:33 -07:00
2015-08-24 10:35:55 -07:00
2015-10-01 20:02:02 -07:00

F-Droid Client

build status Translation status

Client for F-Droid, the Free Software repository system for Android.

Building with Gradle

The only requirements are the Android SDK and Gradle 2.4 or newer:

cd F-Droid
gradle assembleRelease

Direct download

You can download the application directly from our site or browse it in the repo.

Contributing

See our Contributing doc for information on how to report issues, translate the app into your language or help with development.

IRC

We are on #fdroid and #fdroid-dev on Freenode. We hold weekly dev meetings on #fdroid-dev on Tuesdays at 21h UTC, which usually last half an hour.

License

This program is Free Software: You can use, study share and improve it at your will. Specifically you can redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Some icons are made by Picol, Icomoon or Dave Gandy from Flaticon or by Google and are licensed by Creative Commons BY 3.0.

Other icons are from the Material Design Icon set released under an Attribution 4.0 International license.

Description
No description provided
Readme GPL-3.0 46 MiB
Languages
Java 98.5%
Shell 0.6%
Python 0.6%
AIDL 0.2%
HTML 0.1%