[TASK] Adapt FAL dumpFile to use PSR-7 response objects
A new driver method streamFile() is added (specified in a new, internal StreamableDriverInterface). streamFile() returns a PSR-7 response which serves the contents of the file. Once this interface will be marked as public, third party drivers will be allowed to return an own response (e.g. containing a redirect to a CDN), providing full controls to headers. It also opens possibilties for optimizations like X-SendFile (apache) or X-Accell-Redirect (nginx) to be used by drivers. We also add SelfEmittableStreamInterface (marked as internal) to support the same fast file sending using readfile() – the interface provides a hook which is called by the AbstractApplication in sendResponse. That means that file contents do not need to be read into memory, stored into a stream, and then read again, but can be piped to stdout by php directly. For all existing drivers backward compatibility is provided by wrapping their dumpFileContents() method into a decorator stream which calls dumpFileContents *when* the response is sent. That means middlewares are able to prevent/stop/enhance the response, but the driver method dumpFileContents is still used – it's delayed until Application::sendResponse. The dumpFileContents method of the ResourceStorage class is now deprecated. ResourceStorage->streamFile() should be used instead. Change-Id: I64e707c1f8350e409ff2505b98531b92b2936e02 Releases: master Resolves: #83793 Reviewed-on: https://review.typo3.org/55585 Reviewed-by:Benni Mack <benni@typo3.org> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
TYPO3com <no-reply@typo3.com> Reviewed-by:
Susanne Moog <susanne.moog@typo3.org> Tested-by:
Susanne Moog <susanne.moog@typo3.org>
Showing
- typo3/sysext/core/Classes/Controller/FileDumpController.php 8 additions, 7 deletionstypo3/sysext/core/Classes/Controller/FileDumpController.php
- typo3/sysext/core/Classes/Http/AbstractApplication.php 8 additions, 2 deletionstypo3/sysext/core/Classes/Http/AbstractApplication.php
- typo3/sysext/core/Classes/Http/FalDumpFileContentsDecoratorStream.php 108 additions, 0 deletions.../core/Classes/Http/FalDumpFileContentsDecoratorStream.php
- typo3/sysext/core/Classes/Http/SelfEmittableLazyOpenStream.php 70 additions, 0 deletions.../sysext/core/Classes/Http/SelfEmittableLazyOpenStream.php
- typo3/sysext/core/Classes/Http/SelfEmittableStreamInterface.php 32 additions, 0 deletions...sysext/core/Classes/Http/SelfEmittableStreamInterface.php
- typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php 35 additions, 1 deletiontypo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
- typo3/sysext/core/Classes/Resource/Driver/StreamableDriverInterface.php 37 additions, 0 deletions...ore/Classes/Resource/Driver/StreamableDriverInterface.php
- typo3/sysext/core/Classes/Resource/Hook/FileDumpEIDHookInterface.php 3 additions, 0 deletions...t/core/Classes/Resource/Hook/FileDumpEIDHookInterface.php
- typo3/sysext/core/Classes/Resource/ResourceStorage.php 66 additions, 0 deletionstypo3/sysext/core/Classes/Resource/ResourceStorage.php
- typo3/sysext/core/Documentation/Changelog/master/Deprecation-83793-FALResourceStorage-dumpFileContents.rst 32 additions, 0 deletions...Deprecation-83793-FALResourceStorage-dumpFileContents.rst
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php 7 additions, 0 deletions.../Configuration/ExtensionScanner/Php/MethodCallMatcher.php
Please register or sign in to comment