From 8e51379e94d291d21add91bdbfbfe925433ea6c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 14 Jul 2017 17:25:22 +0200 Subject: [PATCH] HTTPS: Zustand korrekt erkennen, und im Workflow verwenden Behebt Probleme, wenn der Server die HTTPS Environmentvariable auf 'off' setzt. --- SL/Form.pm | 4 ++-- SL/Request.pm | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index ea724b33e..1610704c8 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -376,7 +376,7 @@ sub _get_request_uri { return URI->new($ENV{HTTP_REFERER})->canonical() if $ENV{HTTP_X_FORWARDED_FOR}; return URI->new if !$ENV{REQUEST_URI}; # for testing - my $scheme = $ENV{HTTPS} && (lc $ENV{HTTPS} eq 'on') ? 'https' : 'http'; + my $scheme = $::request->is_https ? 'https' : 'http'; my $port = $ENV{SERVER_PORT}; $port = undef if (($scheme eq 'http' ) && ($port == 80)) || (($scheme eq 'https') && ($port == 443)); @@ -426,7 +426,7 @@ sub create_http_response { $session_cookie = $cgi->cookie('-name' => $main::auth->get_session_cookie_name(), '-value' => $session_cookie_value, '-path' => $uri->path, - '-secure' => $ENV{HTTPS}); + '-secure' => $::request->is_https); } } diff --git a/SL/Request.pm b/SL/Request.pm index 8d62f17d0..00744ac0d 100644 --- a/SL/Request.pm +++ b/SL/Request.pm @@ -42,6 +42,10 @@ sub init_type { return 'html'; } +sub is_https { + $ENV{HTTPS} && 'on' eq lc $ENV{HTTPS}; +} + sub cache { my ($self, $topic, $default) = @_; -- 2.20.1