90471[!!!][TASK] Streamline PSR-7 response header handling
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Garvin Hicking +1
- Simon Schaufelberger +1
-
Verified V +2 Done
- Christian Kuhn +2
- Garvin Hicking +1
- core-ci +1 CI
Issues 3
Files 9
- typo3/sysext/core/Classes/Http/AbstractApplication.php+6 −10
- typo3/sysext/core/Documentation/Changelog/14.0/Breaking-107324-StreamlinePSR7ResponseHeaderHandling.rst4new+73 −0
- typo3/sysext/extbase/Classes/Core/Bootstrap.php8+9 −8
- typo3/sysext/extbase/Tests/Functional/Mvc/Controller/BlogPostEditingControllerTest.php2+2 −2
- typo3/sysext/extbase/Tests/Functional/Mvc/Controller/FileUploadControllerTest.php+1 −1
- typo3/sysext/frontend/Classes/Http/RequestHandler.php+12 −0
- typo3/sysext/frontend/Classes/Middleware/PrepareTypoScriptFrontendRendering.php+6 −0
- typo3/sysext/frontend/Classes/Response/ResponseData.php7new+95 −0
- .phpstorm.meta.php+2 −0
Review log 5577
Show 3752 earlier messages
-
Tim Weisenberger uploaded patch set 1 08/21/25, 20:56
-
core-ci voted on patch set 1 V -1 08/21/25, 21:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83717
-
Tim Weisenberger uploaded patch set 2
V -108/23/25, 13:22 -
core-ci voted on patch set 2 V -1 08/23/25, 13:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83795
-
Tim Weisenberger updated the commit message in patch set 3
V -108/23/25, 13:46 -
core-ci voted on patch set 3 V -1 08/23/25, 13:56 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83796
-
Tim Weisenberger uploaded patch set 4
V -108/23/25, 17:12 -
core-ci voted on patch set 4 V +1 08/23/25, 17:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83802
-
Tim Weisenberger uploaded patch set 5
V +108/23/25, 19:04 -
core-ci voted on patch set 5 V +1 08/23/25, 19:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83803
-
Tim Weisenberger marked it ready for review 08/23/25, 19:16
-
Simon Schaufelberger commented on patch set 5 08/25/25, 07:51
-
Tim Weisenberger uploaded patch set 6
V +108/25/25, 20:12 -
Tim Weisenberger commented on patch set 6 08/25/25, 20:14
Breaking-107324-StreamlinePSR7ResponseHeaderHandling.rst:20ReplyDone -
core-ci voted on patch set 6 V +1 08/25/25, 20:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83852
-
Simon Schaufelberger wrote 08/25/25, 21:41
Removed cc Simon Schaufelberger. -
Tim Weisenberger uploaded patch set 7
V +111/07/25, 17:31 -
core-ci voted on patch set 7 V -1 11/07/25, 17:47 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88662
-
Tim Weisenberger uploaded patch set 8
V -111/07/25, 17:51 -
core-ci voted on patch set 8 V -1 11/07/25, 18:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88666
-
Tim Weisenberger uploaded patch set 9
V -111/07/25, 21:15 -
core-ci voted on patch set 9 V +1 11/07/25, 21:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88672
-
Garvin Hicking commented on patch set 9 11/07/25, 21:47
RequestMiddlewares.php:170these have been merged, see https://review.typo3.org/c/Packages/TYPO3.CMS/+/91246 -
Garvin Hicking commented on patch set 9 11/07/25, 21:50
BlogPostEditingControllerTest.php:120Why does this no longer contain a HTTP/200 response, could you explain this to a tired me? 😅 -
Tim Weisenberger uploaded patch set 10
V +111/07/25, 22:11 -
Simon Schaufelberger commented on patch set 9 11/07/25, 22:16
Breaking-107324-StreamlinePSR7ResponseHeaderHandling.rst:5missing 2 more == -
core-ci voted on patch set 10 V +1 11/07/25, 22:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88673
-
Tim Weisenberger uploaded patch set 11
V +111/07/25, 22:22 -
core-ci voted on patch set 11 V +1 11/07/25, 22:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88674
-
Tim Weisenberger commented on patch set 11 11/07/25, 22:35
Breaking-107324-StreamlinePSR7ResponseHeaderHandling.rst:5ReplyDoneBlogPostEditingControllerTest.php:120ReplyBefore this patch, the response object did not always contain the real status code, as this was not set in Extbase via the response object but directly via the header function if the status code was > 300 (see change in Bootstrap.php). This means that the behavior in the browser or for the user has not changed, but rather the test now receives the real status code, which is also delivered to the browser.RequestMiddlewares.php:170ReplyThanks for the hint, I have adapted the configuration for the middleware in line with the changes. -
Simon Schaufelberger commented on patch set 11 11/08/25, 01:07
to have persistent urls, press y when you are on the url and you will get the commit hash. then this link won't get out of sync. -
Tim Weisenberger updated the commit message in patch set 12
V +111/08/25, 13:46 -
core-ci voted on patch set 12 V +1 11/08/25, 13:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/88701
-
Tim Weisenberger commented on patch set 12 11/08/25, 13:55
Reply
Good point, done. -
Simon Schaufelberger voted on patch set 12 CR +1 11/08/25, 14:31
-
Sascha Nowak voted on patch set 12 CR +1 V +1 11/08/25, 20:31
-
Stefan Bürk commented on patch set 12 11/12/25, 10:47
To be honest I only did a pure code review yet, not testing anything out. I'm not confident with the current code and left some comments stating my brain-provblems for some places. Putting all together, I would say that just from reading the code the promise stated in the commit message and the rest file are not full-filled. This needs deeper testing after some code changes, and I'd say we should add some functional tests to it special having "multiple" extbase plugins on the same page rendered returning response object with response headers and the behaviour - which would make "clear" what really happens even for code-readers only. Can pick up that next week to work an and checking more in depth ....Bootstrap.php:176> With this change, multiple header values are preserved, resulting in multiple header lines. The code here sets the headers from the extbase plugin response replacing values for already existing header $name, for example of another extbase plugin rendered already on the page (multiple plugins on one page). That means that only the headers for a header $name of the "last" plugin are taken .. and not preserving all values. That counts for "all" header lines, if they support multi header occurances or not. Note: This would remove `Set-Cookie` from prior extbase plugins and only using the cookies from the last plugin setting this header.Bootstrap.php:182IMO the whole block does not make much sense anways. In practice, status codes >= 300 are not returned by thrown as `PropagateImmediateException` leaving the way back here out as it does not make "sense" to render the full page to just return a "redirect response along with the redirect url header" .... or for example to output file contents (having status code 200 anyway). Not completly sure, but if I remember right we had a StopAction exception thrown here in that case which got removed. We can keep it, but not sure if keeping that here really makes sense, beside it "transports" the statuscode "wished" and returns a not really graspabke state in the end. On top of that ... only the "values" from the last "plugin" would win.TypoScriptFrontendController.php:442> With this change, multiple header values are preserved, resulting in multiple header lines. This code here sets a header from the internal response-data container as full replacement as singel source of truth for it .. it does not preseves eventually set headers (merging them) ... I think that this should be `$repsonse->withAddedHeader()` here.TypoScriptFrontendController.php:447Reassigning and creating a object permutatiion just to assign the same body again das not make much sense, or do I miss something essential here ? I'd say this line should be removed making no sense. What do you say ?ResponseDataInitialization.php:46Thinking about it, I guess I would personally prefere to have this attribute initalization not as a dedicated middleware and instead adding it directly to the `\TYPO3\CMS\Frontend\Middleware\PrepareTypoScriptFrontendRendering`. Beside that, even if it would stay as dedicated middleware we don't need the middlware property state here .. middleware should be called only once. In case of a "subrequest" the dispatching place should incorporate that.ResponseData.php:28Not sure if we may eventualy simply us the a message or response object directly as data container for the request attribute and avoiding a new additional class with subset of it and additional code to maintain.ResponseData.php:72The implementation here is quite simple and leaves a lot out which is done in the casual response object, for example: * does not respect the `case-insensitive` nature of header names ... * not realy handling $value, which should be an array .. or in case of a string persisted as an array -> `(string)$value -> $value = [$value]` * this implementation only supports kind of "full set" only and not the "add a header on top of the stack for the header name" See for example: https://github.com/TYPO3/typo3/blob/174e7fdd5db09aa783a5a15bd73156651de8deca/typo3/sysext/core/Classes/Http/Message.php#L187-L280ResponseData.php:72This implementation leaves a lot out. I assume that has been done either accedentially -
Stefan Bürk updated the commit message in patch set 13
CR +1V +111/12/25, 10:47 -
Stefan Bürk commented on patch set 13 11/12/25, 10:48
ResponseData.php:28ReplyA wait - that does not work due to the immutable nature of these classes :/ :/ResponseData.php:72Reply -
core-ci voted on patch set 13 V +1 11/12/25, 10:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89250
-
Stefan Bürk voted on patch set 13 CR -1 11/12/25, 11:12
-
Tim Weisenberger uploaded patch set 14
CR -1V +111/12/25, 20:55 -
core-ci voted on patch set 14 V +1 11/12/25, 21:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89397
-
Tim Weisenberger commented on patch set 14 11/12/25, 22:08
Bootstrap.php:176ReplyThis behavior is intentional. The statement "With this change, multiple header values are preserved, resulting in multiple header lines." does not mean that if a header with the same name is set in several places in the request lifecycle, it will be merged and retained, but rather that if a string is provided, a single header line will be used, and if a string array is provided, all values from this string array will be output as separate header lines and no concatenation with commas is enforced. The implementation in this way also preserves the the behavior of the current implementation, as here (https://github.com/TYPO3/typo3/blob/05ef22fb2209f5d0b6c2210433c52ed04a1b9423/typo3/sysext/extbase/Classes/Core/Bootstrap.php#L175) no value for the third-parameter is set, which results that the a extbase plugin would overwrite the header of the prior extbase plugin, when the header is not send already.Bootstrap.php:182ReplyWhen I saw the block for the first time, I had the same thought. For redirect messages (HTTP status code 300-399), further rendering of the page makes no sense and you could use a PropagateResponseException at this point. For HTTP status codes >= 400, it might make sense if the Extbase plugin allows the page to be rendered. For example, rendering an error message with the “frame” of the page. In the end I kept this block so as not to break too many existing implementations unnecessarily. This approach also ensures the continuity of my basic idea for the patch, namely that it is possible to completely manipulate the headers at any point in the entire lifecycle (HTTP request -> AbstractApplication -> HTTP middlewares -> TSFE -> Extbase plugin 1 -> ... Extbase Plugin n -> TSFE -> HTTP middlewares -> AbstractApplication -> HTTP Response), as it is also possible with a PHP framework that consistently uses an PSR-7 request and PSR-7 response object.TypoScriptFrontendController.php:447ReplyGood point, that line is redundant, it should definitely be removed. A new patch has been pushed.ResponseData.php:72ReplyThe use of the ResponseData attribute outside of the use case implemented so far is not planned, which is why it is marked as internal. In my opinion, another normalization of the headers at this point would be redundant in the current use case, since normalization already takes place in the PSR-7 response from Extbase. -
Tim Weisenberger commented on patch set 14 11/12/25, 22:10
TypoScriptFrontendController.php:447ReplyDone -
Christian Kuhn uploaded patch set 15
V +111/17/25, 14:33 -
Christian Kuhn commented on patch set 15 11/17/25, 14:34
rebased for now. -
Christian Kuhn commented on patch set 15 11/17/25, 14:40
Bootstrap.php:175it's great getting rid of remaining header() calls!ResponseDataInitialization.php:36i wonder if we could maybe merge this middleware with another one to safe one additional middleware. -
core-ci voted on patch set 15 V +1 11/17/25, 14:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89946
-
Christian Kuhn commented on patch set 15 11/17/25, 17:18
Reply
DoneBootstrap.php:175ReplyDoneBootstrap.php:176ReplyDoneBootstrap.php:182Replyyes. we will and should talk about proper 3xx / 4xx handling from within extensions.TypoScriptFrontendController.php:442ReplyDoneResponseDataInitialization.php:36ReplyDoneResponseDataInitialization.php:46Replysame feeling. we did that.ResponseData.php:72Replyyes. our goal is to fix the issue itself for now. we will have to model the entire page-part and http-response segments in a better way in the future. we added some todo with the patch to point that out. -
Christian Kuhn uploaded patch set 16
V +111/17/25, 17:18 -
Christian Kuhn voted on patch set 16 CR +1 V +1 11/17/25, 17:19
-
core-ci voted on patch set 16 V +1 11/17/25, 17:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89953
-
Christian Kuhn updated the commit message in patch set 17
CR +1V +111/17/25, 17:29 -
Christian Kuhn voted on patch set 17 CR +1 V +1 11/17/25, 17:29
-
core-ci voted on patch set 17 V +1 11/17/25, 17:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89955
-
Christian Kuhn uploaded patch set 18
CR +1V +111/17/25, 18:06 -
Christian Kuhn voted on patch set 18 CR +1 V +1 11/17/25, 18:07
-
Garvin Hicking commented on patch set 18 CR +1 V +1 11/17/25, 18:11
Thanks a lot for everyone involved, I think the final outcome of this is very lean and a great basis for more streamlining, without behing a burden. Thanks Tim for for staying on it! :-) -
core-ci voted on patch set 18 V +1 11/17/25, 18:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/89958
-
Christian Kuhn commented on patch set 18 CR -1 11/17/25, 19:42
wanna recheck a detail with Tim. -
Benni Mack commented on patch set 18 CR -1 11/18/25, 08:27
must be a [TASK]. Mainly because this "feature" is internal, I'd rather say even it's a bugfix. -
Christian Kuhn uploaded patch set 19
CR +1V +111/18/25, 16:59 -
Christian Kuhn commented on patch set 19 11/18/25, 17:01
Reply
thx. done.Reply
there is an additional issue when multiple extbase plugins try to set the same header: last one wins. we can not change that right now, so i elaborated on it in the commit message and roughly in the .rst file. -
Christian Kuhn updated the commit message in patch set 20 11/18/25, 17:04
-
Christian Kuhn updated the commit message in patch set 21 11/18/25, 17:06
-
Christian Kuhn updated the commit message in patch set 22 11/18/25, 17:07
-
core-ci voted on patch set 19 V +1 11/18/25, 17:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90061
-
core-ci voted on patch set 20 V +1 11/18/25, 17:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90062
-
core-ci voted on patch set 21 V +1 11/18/25, 17:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90063
-
core-ci voted on patch set 22 V +1 11/18/25, 17:16 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90064
-
Garvin Hicking voted on patch set 22 CR +1 V +1 11/18/25, 18:57
-
Christian Kuhn commented on patch set 22 CR +1 V +1 11/18/25, 19:10
waiting for a last sign-off from tim. -
Tim Weisenberger commented on patch set 22 11/18/25, 19:48
Reply
LGTM -
Simon Schaufelberger voted on patch set 22 CR +1 11/18/25, 19:51
-
Christian Kuhn voted on patch set 22 CR +2 V +2 11/18/25, 19:53
-
Christian Kuhn merged patch set 23 11/18/25, 19:53
Breaking-107324-StreamlinePSR7ResponseHeaderHandling.rst:20