Compare commits

...

4 Commits

Author SHA1 Message Date
Simon Sessingø 5c36e9c652 Merge pull request #31 from skipperbent/development
[BUGFIX] Fixed support for urls like /path/{param}/path
2015-11-20 07:18:31 +01:00
Simon Sessingø b930c06683 [BUGFIX] Fixed support for urls like /path/{param}/path 2015-11-20 07:17:49 +01:00
Simon Sessingø 0f8bba7c32 Merge pull request #30 from skipperbent/development
[FEATURE] Added getIsSecure method to Request class.
2015-11-18 19:20:11 +01:00
Simon Sessingø 19dc295199 [FEATURE] Added getIsSecure method to Request class. 2015-11-18 19:19:15 +01:00
2 changed files with 9 additions and 2 deletions
+4
View File
@@ -30,6 +30,10 @@ class Request {
$this->headers = array_change_key_case(getallheaders(), CASE_LOWER);
}
public function getIsSecure() {
return isset($_SERVER['HTTPS']) ? true : (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] === 443);
}
/**
* @return string
*/
+5 -2
View File
@@ -42,12 +42,15 @@ class RouterRoute extends RouterEntry {
$url = parse_url($request->getUri());
$url = $url['path'];
$route = $this->url;
$route = rtrim($this->url, '/') . '/';
$routeMatch = preg_replace('/\/{0,1}'.self::PARAMETERS_REGEX_MATCH.'\/{0,1}/is', '', $route);
$tmp = explode('/', $route);
$tmp2 = explode('/', $url);
// Check if url parameter count matches
if(stripos($url, $routeMatch) === 0) {
if(stripos($url, $routeMatch) === 0 || count($tmp) === count($tmp2)) {
$matches = true;