8000 Fix checking protocol (HTTP/HTTPS) by piotrplenik · Pull Request #23 · oauth-io/sdk-php · GitHub
[go: up one dir, main page]

Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix checking protocol (HTTP/HTTPS)
Referring to "http://php.net/manual/en/reserved.variables.server.php" $_SERVER['HTTPS'] is non-empty value
  • Loading branch information
piotrplenik committed Sep 2, 2016
commit c3bdfe0864da8c155413a0c2633578b75f5ad83a
2 changes: 1 addition & 1 deletion src/OAuth_io/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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=' .
Expand Down
0