From 655927851159a654a32e232eab2742af02569ce4 Mon Sep 17 00:00:00 2001 From: Juan Antonio Tubio Date: Sat, 4 Nov 2017 00:19:51 +0100 Subject: [PATCH 1/6] Documentation: Add file exception rules samples to IIS web.config --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 7817f6a..e6a55ad 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,15 @@ Simply create a new `web.config` file in your projects `public` directory and pa ``` +#### Troubleshoting + +If you do not have a favicon.ico file in your project, you can get `404 Router::notFoundException()` constantly. +To add `favicon.ico` as exception, you can add this line to the `` group: +`````` + +You can also make one exception for files with some extensions: +`````` + ### Configuration Create a new file, name it `routes.php` and place it in your library folder. This will be the file where you define all the routes for your project. From 2221bced4fe17032a6784efa5defcced7dbb52bb Mon Sep 17 00:00:00 2001 From: Juan Antonio Tubio Date: Sat, 4 Nov 2017 00:27:13 +0100 Subject: [PATCH 2/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e6a55ad..ec7749f 100644 --- a/README.md +++ b/README.md @@ -215,10 +215,10 @@ Simply create a new `web.config` file in your projects `public` directory and pa #### Troubleshoting If you do not have a favicon.ico file in your project, you can get `404 Router::notFoundException()` constantly. -To add `favicon.ico` as exception, you can add this line to the `` group: +To add `favicon.ico` as exception, you can add this line to the `` group: `````` -You can also make one exception for files with some extensions: +You can also make one exception for files with some extensions: `````` ### Configuration From 74177a20828e6d6a7de107419eb3bd54ec3d46da Mon Sep 17 00:00:00 2001 From: Juan Antonio Tubio Date: Sat, 4 Nov 2017 00:59:52 +0100 Subject: [PATCH 3/6] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index ec7749f..f416e0d 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,9 @@ To add `favicon.ico` as exception, you can add this line to the `` g You can also make one exception for files with some extensions: `````` +If you are using `$_SERVER['ORIG_PATH_INFO']`, you will get `\index.php\` as part of the returned value. By sample: +```/index.php/test/mypage.php``` + ### Configuration Create a new file, name it `routes.php` and place it in your library folder. This will be the file where you define all the routes for your project. From ebeca952cf572f15ce78f5b903cd598288b3dc1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Wed, 8 Nov 2017 04:09:41 +0100 Subject: [PATCH 4/6] Revert "V3 development" --- README.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/README.md b/README.md index f416e0d..7817f6a 100644 --- a/README.md +++ b/README.md @@ -212,18 +212,6 @@ Simply create a new `web.config` file in your projects `public` directory and pa ``` -#### Troubleshoting - -If you do not have a favicon.ico file in your project, you can get `404 Router::notFoundException()` constantly. -To add `favicon.ico` as exception, you can add this line to the `` group: -`````` - -You can also make one exception for files with some extensions: -`````` - -If you are using `$_SERVER['ORIG_PATH_INFO']`, you will get `\index.php\` as part of the returned value. By sample: -```/index.php/test/mypage.php``` - ### Configuration Create a new file, name it `routes.php` and place it in your library folder. This will be the file where you define all the routes for your project. From 6ad22a3816c2bce33ba956a190b04014438fa137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Wed, 8 Nov 2017 04:11:40 +0100 Subject: [PATCH 5/6] Revert "Revert "V3 development"" --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 7817f6a..f416e0d 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,18 @@ Simply create a new `web.config` file in your projects `public` directory and pa ``` +#### Troubleshoting + +If you do not have a favicon.ico file in your project, you can get `404 Router::notFoundException()` constantly. +To add `favicon.ico` as exception, you can add this line to the `` group: +`````` + +You can also make one exception for files with some extensions: +`````` + +If you are using `$_SERVER['ORIG_PATH_INFO']`, you will get `\index.php\` as part of the returned value. By sample: +```/index.php/test/mypage.php``` + ### Configuration Create a new file, name it `routes.php` and place it in your library folder. This will be the file where you define all the routes for your project. From 97753f5370e3498652ec49acaa5dcc80e345d4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Fri, 10 Nov 2017 08:23:15 +0100 Subject: [PATCH 6/6] Minor optimisations. --- src/Pecee/CsrfToken.php | 3 ++- src/Pecee/Http/Request.php | 28 +++------------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/Pecee/CsrfToken.php b/src/Pecee/CsrfToken.php index 3549243..0828279 100644 --- a/src/Pecee/CsrfToken.php +++ b/src/Pecee/CsrfToken.php @@ -15,7 +15,7 @@ class CsrfToken */ public static function generateToken() { - if (function_exists('random_bytes')) { + if (function_exists('random_bytes') === true) { return bin2hex(random_bytes(32)); } @@ -46,6 +46,7 @@ class CsrfToken /** * Set csrf token cookie + * Overwrite this method to save the token to another storage like session etc. * * @param $token */ diff --git a/src/Pecee/Http/Request.php b/src/Pecee/Http/Request.php index dedf144..5c124d0 100644 --- a/src/Pecee/Http/Request.php +++ b/src/Pecee/Http/Request.php @@ -1,4 +1,5 @@ headers = []; - $max = count($_SERVER) - 1; - $keys = array_keys($_SERVER); - - for ($i = $max; $i >= 0; $i--) { - $key = $keys[$i]; - $value = $_SERVER[$key]; - + foreach ($_SERVER as $key => $value) { $this->headers[strtolower($key)] = $value; $this->headers[strtolower(str_replace('_', '-', $key))] = $value; } @@ -167,24 +162,7 @@ class Request */ public function getHeader($name, $defaultValue = null) { - if (array_key_exists(strtolower($name), $this->headers) === true) { - return $this->headers[strtolower($name)]; - } - - $max = count($_SERVER) - 1; - $keys = array_keys($_SERVER); - - for ($i = $max; $i >= 0; $i--) { - - $key = $keys[$i]; - $name = $_SERVER[$key]; - - if ($key === $name) { - return $name; - } - } - - return $defaultValue; + return isset($this->headers[strtolower($name)]) ? $this->headers[strtolower($name)] : $defaultValue; } /**