mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-16 02:30:09 +03:00
[TASK]
- Added support for setups where getallheaders function is not availible. - Made matchDomain method in RouterGroup always return boolean.
This commit is contained in:
@@ -27,7 +27,17 @@ class Request {
|
||||
$this->host = $_SERVER['HTTP_HOST'];
|
||||
$this->uri = $_SERVER['REQUEST_URI'];
|
||||
$this->method = (isset($_POST['_method'])) ? strtolower($_POST['_method']) : strtolower($_SERVER['REQUEST_METHOD']);
|
||||
$this->headers = array_change_key_case(getallheaders(), CASE_LOWER);
|
||||
$this->headers = $this->getAllHeaders();
|
||||
}
|
||||
|
||||
public function getAllHeaders() {
|
||||
$headers = array();
|
||||
foreach ($_SERVER as $name => $value) {
|
||||
if (substr($name, 0, 5) === 'HTTP_') {
|
||||
$headers[str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($name, 5))))] = $value;
|
||||
}
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
|
||||
public function getIsSecure() {
|
||||
|
||||
Reference in New Issue
Block a user