[TASK] Use TYPO3_SSL for the URL schema enforcement test 52/49752/4
authorPatrick Kollodzik <patrick.kollodzik@gmail.com>
Fri, 2 Sep 2016 11:44:49 +0000 (13:44 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 31 Dec 2016 14:13:34 +0000 (15:13 +0100)
The enforement of the url_schema field should not be based
on the requested URL schema, but on the TYPO3_SSL enviroment
variable.

This will make it possible to switch the URL schema
based on enviroment variables.

Resolves: #77781
Releases: master
Change-Id: I8fec7d7787af3397051a256bc5222f2b006ef7c0
Reviewed-on: https://review.typo3.org/49752
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 5e11d85..c75fdf9 100644 (file)
@@ -1460,10 +1460,12 @@ class TypoScriptFrontendController
         }
         if ($this->page['url_scheme'] > 0) {
             $newUrl = '';
-            $requestUrlScheme = parse_url(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), PHP_URL_SCHEME);
-            if ((int)$this->page['url_scheme'] === HttpUtility::SCHEME_HTTP && $requestUrlScheme == 'https') {
+            $currentRequestIsSecure = GeneralUtility::getIndpEnv('TYPO3_SSL');
+            // force http
+            if ((int)$this->page['url_scheme'] === HttpUtility::SCHEME_HTTP && $currentRequestIsSecure) {
                 $newUrl = 'http://' . substr(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 8);
-            } elseif ((int)$this->page['url_scheme'] === HttpUtility::SCHEME_HTTPS && $requestUrlScheme == 'http') {
+            } elseif ((int)$this->page['url_scheme'] === HttpUtility::SCHEME_HTTPS && !$currentRequestIsSecure) {
+                // force https
                 $newUrl = 'https://' . substr(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'), 7);
             }
             if ($newUrl !== '') {