Added Range support to FileBackend::streamFile()
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 20 Apr 2014 08:40:06 +0000 (01:40 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 4 Jun 2016 12:43:43 +0000 (05:43 -0700)
commitd42a05475a1fec48de72fdee961de66c1af2279a
tree27079d0a19d57dc0dcfc3b6fb6b3263924679d2b
parent633c0da23af1cdb16f8edb6252f1c1138422162c
Added Range support to FileBackend::streamFile()

* Added HTTP options headers parameter to streamFile().
* Refactored doStreamFile() to either call StreamFile::stream()
  or delagate that to the subclass. SwiftFileBackend now relays
  the full Swift response rather than manually making the headers.
  This also makes Range headers easy to support.
* Made use of this in img_auth.php for performance on private wikis.
* Elimate stat call in streamFile() for Swift if "headers" is empty.
* Refactored StreamFile a bit to inject request headers instead
  of using the $_SERVER global. A header options parameter is used
  instead, which also supports Range.
* Removed now unused prepareForStream().
* Cleaned up streamFile() unit tests.

Change-Id: I2ccbcbca6caabb8cf65bd6b3084cede2e6ea628a
img_auth.php
includes/StreamFile.php
includes/filebackend/FileBackend.php
includes/filebackend/FileBackendStore.php
includes/filebackend/MemoryFileBackend.php
includes/filebackend/SwiftFileBackend.php
includes/filerepo/FileRepo.php
includes/libs/MultiHttpClient.php
tests/phpunit/includes/filebackend/FileBackendTest.php