[BUGFIX] Don't send HTTP headers in CLI context

Resolves: #58029
Releases: 6.2
Change-Id: If2a5f41e8524c457a20dec810f711f546d4fbb8c
Reviewed-on: https://review.typo3.org/29554
Reviewed-by: Stefan Neufeind
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Reviewed-by: Markus Klein
Tested-by: Markus Klein