From 97cf8dd5a8d7054c1d5747fbb56614d8dcba02df Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 7 Mar 2019 19:00:15 +0100 Subject: [PATCH 1/5] Make app optional --- Dispatcher/Dispatcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dispatcher/Dispatcher.php b/Dispatcher/Dispatcher.php index a38f5f81c..7866565fa 100644 --- a/Dispatcher/Dispatcher.php +++ b/Dispatcher/Dispatcher.php @@ -55,7 +55,7 @@ final class Dispatcher * * @since 1.0.0 */ - public function __construct(ApplicationAbstract $app) + public function __construct(ApplicationAbstract $app = null) { $this->app = $app; } From 1e79d9616adf011eb0998b38f354df8b20ab9ea2 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 8 Mar 2019 20:53:43 +0100 Subject: [PATCH 2/5] Set port --- Uri/UriFactory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Uri/UriFactory.php b/Uri/UriFactory.php index 8797b2266..465e11d19 100644 --- a/Uri/UriFactory.php +++ b/Uri/UriFactory.php @@ -116,6 +116,7 @@ final class UriFactory { self::setQuery('/scheme', $uri->getScheme()); self::setQuery('/host', $uri->getHost()); + self::setQuery('/port', (string) $uri->getPort()); self::setQuery('/base', \rtrim($uri->getBase(), '/')); self::setQuery('/rootPath', $uri->getRootPath()); self::setQuery('?', $uri->getQuery()); From 156c5849c7f2f7f60f5e3911f598c360fd6a09b2 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 9 Mar 2019 16:16:07 +0100 Subject: [PATCH 3/5] Fix current uri scheme --- Uri/Http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Uri/Http.php b/Uri/Http.php index fa20e28ba..4c0c5f4c0 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -187,7 +187,7 @@ final class Http implements UriInterface public static function getCurrent() : string { /** @noinspection PhpUndefinedConstantInspection */ - return 'http://' . ($_SERVER['HTTP_HOST'] ?? '') . ($_SERVER['REQUEST_URI'] ?? ''); + return (\stripos($_SERVER['SERVER_PROTOCOL'], 'https') !== false ? 'https' : 'http' ) . '://' . ($_SERVER['HTTP_HOST'] ?? '') . ($_SERVER['REQUEST_URI'] ?? ''); } /** From 80f58b9d2478a1995c71255587e768909f5081db Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 9 Mar 2019 16:26:18 +0100 Subject: [PATCH 4/5] Fix base scheme --- Uri/Http.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Uri/Http.php b/Uri/Http.php index 4c0c5f4c0..2168495e6 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -187,7 +187,10 @@ final class Http implements UriInterface public static function getCurrent() : string { /** @noinspection PhpUndefinedConstantInspection */ - return (\stripos($_SERVER['SERVER_PROTOCOL'], 'https') !== false ? 'https' : 'http' ) . '://' . ($_SERVER['HTTP_HOST'] ?? '') . ($_SERVER['REQUEST_URI'] ?? ''); + return ((!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off') + || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') + || (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on')) + . '://' . ($_SERVER['HTTP_HOST'] ?? ''). ($_SERVER['REQUEST_URI'] ?? ''); } /** From bddeff5a0c18a654baa6fb0b5360a48fa4dda975 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 9 Mar 2019 16:28:09 +0100 Subject: [PATCH 5/5] Fix base scheme --- Uri/Http.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Uri/Http.php b/Uri/Http.php index 2168495e6..4c9e72624 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -189,7 +189,7 @@ final class Http implements UriInterface /** @noinspection PhpUndefinedConstantInspection */ return ((!empty($_SERVER['HTTPS'] ?? '') && ($_SERVER['HTTPS'] ?? '') !== 'off') || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') - || (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on')) + || (($_SERVER['HTTP_X_FORWARDED_SSL'] ?? '') === 'on') ? 'https' : 'http') . '://' . ($_SERVER['HTTP_HOST'] ?? ''). ($_SERVER['REQUEST_URI'] ?? ''); }