[FEATURE] Add support for PSR-15 HTTP middlewares 44/55544/7
authorBenjamin Franzke <bfr@qbus.de>
Sat, 3 Feb 2018 22:56:37 +0000 (23:56 +0100)
committerBenni Mack <benni@typo3.org>
Tue, 6 Feb 2018 20:09:08 +0000 (21:09 +0100)
commit9266297fb96d8f006685cd518e1d484f2c334ddd
tree31d904285f7aefc12793c935ae58e71fd4b0611c
parent8bcf6b29857944eb381b7a5a5b0e55e3cc06789c
[FEATURE] Add support for PSR-15 HTTP middlewares

PSR-15 middlewares are hooks on steroids for HTTP requests.
Due to chaining middlewares and the core request handler(s),
middlewares can execute code before and after the application.

Middlewares may return early, that means they can prevent
consecutive middleware and the core application from being executed
at all.

A full middleware coverage for *all* requests will need
a lot of changes to the core and extensions.
We'll eventually need to stop using header()/exit()/die()
or HttpUtility::{redirect,sendRespose}(). Those method calls
need to be replaced by manipulation of PSR-7 message objects.

PSR-15 interfaces are provided by psr/http-server-middleware:

composer require psr/http-server-middleware:^1.0

Change-Id: Ia906d51da2e4309a37fb47a7966b52f873782d8f
Releases: master
Resolves: #83725
Reviewed-on: https://review.typo3.org/55544
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
15 files changed:
composer.json
composer.lock
typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php
typo3/sysext/backend/Classes/Http/Application.php
typo3/sysext/backend/Classes/Http/RequestHandler.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/MiddlewareStackResolver.php [new file with mode: 0644]
typo3/sysext/core/Documentation/Changelog/master/Feature-83725-SupportForPSR-15HTTPMiddlewares.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/Fixtures/MiddlewareFixture.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/MiddlewareDispatcherTest.php [new file with mode: 0644]
typo3/sysext/core/composer.json
typo3/sysext/frontend/Classes/Http/Application.php
typo3/sysext/frontend/Classes/Http/EidRequestHandler.php
typo3/sysext/frontend/Classes/Http/RequestHandler.php