summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML
diff options
context:
space:
mode:
authorJaime Perez Crespo <jaime.perez@uninett.no>2016-03-03 15:24:42 +0100
committerJaime Perez Crespo <jaime.perez@uninett.no>2016-03-03 15:24:42 +0100
commitb3136393b1b858ad6209db234d2716388e208e84 (patch)
tree080ef974084709e521a795208791ef73fd6e9106 /lib/SimpleSAML
parent3bfed3c4fa6f2a85be53c75bd534243cdc4231d8 (diff)
downloadsimplesamlphp-b3136393b1b858ad6209db234d2716388e208e84.zip
simplesamlphp-b3136393b1b858ad6209db234d2716388e208e84.tar.gz
simplesamlphp-b3136393b1b858ad6209db234d2716388e208e84.tar.bz2
Fix a couple formatting issues in SimpleSAML\Utils\HTTP. Start using SimpleSAML\Module and SimpleSAML\Logger in there.
Diffstat (limited to 'lib/SimpleSAML')
-rw-r--r--lib/SimpleSAML/Utils/HTTP.php46
1 files changed, 31 insertions, 15 deletions
diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php
index 7aea966..39ecec0 100644
--- a/lib/SimpleSAML/Utils/HTTP.php
+++ b/lib/SimpleSAML/Utils/HTTP.php
@@ -1,6 +1,8 @@
<?php
namespace SimpleSAML\Utils;
+use SimpleSAML\Module;
+use SimpleSAML\Logger;
/**
* HTTP-related utility methods.
@@ -28,7 +30,7 @@ class HTTP
// encrypt the session ID and the random ID
$info = base64_encode(Crypto::aesEncrypt($session->getSessionId().':'.$id));
- $url = \SimpleSAML_Module::getModuleURL('core/postredirect.php', array('RedirInfo' => $info));
+ $url = Module::getModuleURL('core/postredirect.php', array('RedirInfo' => $info));
return preg_replace('#^https:#', 'http:', $url);
}
@@ -157,7 +159,7 @@ class HTTP
}
if (strlen($url) > 2048) {
- \SimpleSAML_Logger::warning('Redirecting to a URL longer than 2048 bytes.');
+ Logger::warning('Redirecting to a URL longer than 2048 bytes.');
}
// set the location header
@@ -282,7 +284,7 @@ class HTTP
// we didn't have a session cookie. Redirect to the no-cookie page
- $url = \SimpleSAML_Module::getModuleURL('core/no_cookie.php');
+ $url = Module::getModuleURL('core/no_cookie.php');
if ($retryURL !== null) {
$url = self::addURLParameters($url, array('retryURL' => $retryURL));
}
@@ -393,7 +395,7 @@ class HTTP
'SNI_enabled' => true,
);
} else {
- \SimpleSAML_Logger::warning('Invalid URL format or local URL used through a proxy');
+ Logger::warning('Invalid URL format or local URL used through a proxy');
}
}
}
@@ -532,10 +534,10 @@ class HTTP
return $protocol.$hostname.$port.$path;
} else {
- throw new \SimpleSAML_Error_Exception('Invalid value for \'baseurlpath\' in '.
- 'config.php. Valid format is in the form: '.
- '[(http|https)://(hostname|fqdn)[:port]]/[path/to/simplesaml/]. '.
- 'It must end with a \'/\'.');
+ throw new \SimpleSAML_Error_Exception(
+ 'Invalid value for \'baseurlpath\' in config.php. Valid format is in the form: '.
+ '[(http|https)://(hostname|fqdn)[:port]]/[path/to/simplesaml/]. It must end with a \'/\'.'
+ );
}
}
@@ -585,7 +587,7 @@ class HTTP
} else { // post the data directly
$session = \SimpleSAML_Session::getSessionFromRequest();
$id = self::savePOSTData($session, $destination, $data);
- $url = \SimpleSAML_Module::getModuleURL('core/postredirect.php', array('RedirId' => $id));
+ $url = Module::getModuleURL('core/postredirect.php', array('RedirId' => $id));
}
return $url;
@@ -977,7 +979,7 @@ class HTTP
// Do not set secure cookie if not on HTTPS
if ($params['secure'] && !self::isHTTPS()) {
- \SimpleSAML_Logger::warning('Setting secure cookie on plain HTTP is not allowed.');
+ Logger::warning('Setting secure cookie on plain HTTP is not allowed.');
return;
}
@@ -992,18 +994,32 @@ class HTTP
}
if ($params['raw']) {
- $success = setrawcookie($name, $value, $expire, $params['path'], $params['domain'], $params['secure'],
- $params['httponly']);
+ $success = setrawcookie(
+ $name,
+ $value,
+ $expire,
+ $params['path'],
+ $params['domain'],
+ $params['secure'],
+ $params['httponly']
+ );
} else {
- $success = setcookie($name, $value, $expire, $params['path'], $params['domain'], $params['secure'],
- $params['httponly']);
+ $success = setcookie(
+ $name,
+ $value,
+ $expire,
+ $params['path'],
+ $params['domain'],
+ $params['secure'],
+ $params['httponly']
+ );
}
if (!$success) {
if ($throw) {
throw new \SimpleSAML_Error_Exception('Error setting cookie: headers already sent.');
} else {
- \SimpleSAML_Logger::warning('Error setting cookie: headers already sent.');
+ Logger::warning('Error setting cookie: headers already sent.');
}
}
}