From c3bdfe0864da8c155413a0c2633578b75f5ad83a Mon Sep 17 00:00:00 2001 From: Piotr Plenik Date: Fri, 2 Sep 2016 10:01:55 +0200 Subject: [PATCH] Fix checking protocol (HTTP/HTTPS) Referring to "http://php.net/manual/en/reserved.variables.server.php" $_SERVER['HTTPS'] is non-empty value --- src/OAuth_io/OAuth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OAuth_io/OAuth.php b/src/OAuth_io/OAuth.php index c32dad0..e0daa34 100644 --- a/src/OAuth_io/OAuth.php +++ b/src/OAuth_io/OAuth.php @@ -126,7 +126,7 @@ public function refreshCredentials($credentials, $force = false) { } public function redirect($provider, $url) { - $urlToRedirect = 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $url; + $urlToRedirect = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $url; $csrf = $this->generateStateToken(); $location = $this->injector->config['oauthd_url'] . $this->injector->config['oauthd_base'] . '/' . $provider . '?k=' . $this->injector->config['app_key'] . '&opts=' .