Read files in chunks to avoid memory limits when download_via_php is enabled. Fixes #2334.
Merge branch 'master' into gh-pages