Commit Graph

799 Commits (test/improve-log-time-validation)

Author SHA1 Message Date
M. Efe Çetin 925d5d03dc
📝 docs: add doc about usage of CSRF and EncryptCookie middlewares. (#2141) 2022-10-06 07:54:29 +02:00
Muhammed Efe Çetin 7fb50f11f6
✏️ v3 : replace utils.AssertEqual with require in filesystem mw tests 2022-09-30 18:34:38 +03:00
M. Efe Çetin 668b0c85f8
v3 (enhancement): refactor filesystem middleware with `io/fs` (#2027)
*  v3 (feature): refactor filesystem middleware with `io/fs`

* update docs

* attachment support.

* fix
2022-09-29 08:28:52 +02:00
kinggo 8e8ad95079
feat: support to set client in proxy mw (#2117)
optimize: add WithClient
2022-09-28 14:27:58 +02:00
Fufu 4108d73fe0
✏️ Fix: typos (#2127)
Fix: typos
2022-09-28 08:55:28 +03:00
Muhammed Efe Çetin ca6f25a890
v3 (deps): move `utils` to `https://github.com/gofiber/utils` 2022-09-23 21:19:44 +03:00
M. Efe Çetin 10d6f69a89
v3 (feature): new redirection methods (#2014)
*  v3 (feature): new redirection methods

* add flash messages

* withinput, parsing flash message

* add tests

* add benchmarks

* gosec issues

* fix tests

* fix tests

* fix performance issues

* fix performance issues

* optimization.

* better names

* fix tests

* Update router.go

* fix

* fix old messaages with flash messages behavior, add new test case with req

* complete some reviews

* add pool for redirection.

* use constant

* update

*  v3 (feature): new redirection methods

* fix tests, optimize cookie parsing (9 allocs -> 1 alloc)

* test case for message includes comma

* cleanup

* optimization.

* some improvements for the redirect feature

* fix Benchmark_Redirect_Route_WithFlashMessages

* some improvements for the redirect feature

* Update redirect.go

* improve message parsing & test case

Co-authored-by: René Werner <rene@gofiber.io>
2022-09-23 08:17:34 +02:00
dayu d461bf231e
Update README.md (#2114)
some demo codes missing parenthesis, i added them to make that codes could be copied and run
2022-09-22 12:30:19 +03:00
M. Efe Çetin 305bb072be
🧹 tidy up: fix linter errors for tests (#2102) 2022-09-19 08:33:58 +02:00
Hakan Kutluay 7c83e38757
🔥 Update: add timeout context middleware (#2090)
* 🔥 Feature: add timeoutcontext middleware

* move timeoutconext to timeout package

* remove timeoutcontext readme.md

* replace timeout mware with timeout context mware

* Update README.md

* Update README.md

* update timeout middleware readme

* test curl commands fixed

* rename sample code title on timeout middleware

Co-authored-by: RW <rene@gofiber.io>
2022-09-16 16:03:02 +02:00
M. Efe Çetin 8ec62a64cc
🧹 update: add methods configuration for cache middleware (#2081)
* 🧹 update: add methods configuration for cache middleware

* 🧹 update: add methods configuration for cache middleware
2022-09-11 13:11:33 +02:00
M. Efe Çetin 281e2f0046
v3 (feature): merge Listen methods & ListenConfig (#1930)
*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

* fix tests

* improve graceful shutdown

* update

* Start -> Listen

* rename test funcs.

* Add Test_Listen_Graceful_Shutdown test.

* add OnShutdownSuccess

* fix tests

* fix tests

* split listen & listener

* typo

* Add retry logic to tests

* Add retry logic to tests

* Add retry logic to tests

* Add retry logic to tests

Co-authored-by: René Werner <rene@gofiber.io>
2022-09-08 07:57:05 +02:00
M. Efe Çetin e9db6c70d2
v3: fix logger benchmarks (#2074)
* v3: fix logger benchmarks

* fix datarace

* fix datarace

* fix datarace
2022-09-06 17:54:39 +02:00
Muhammed Efe Çetin e3282f6408
♻️ v3 (enhancement): replace `c.Hostname()` -> `c.Host()` & add `c.Hostname()` that returns host without port 2022-09-06 18:43:06 +03:00
Muhammed Efe Çetin 78c6197430
♻️ v3 (enhancement): remove automatic HEAD method creation from Get()
ref: https://github.com/gofiber/fiber/issues/2026
2022-09-05 17:41:39 +03:00
M. Efe Çetin 154e4f8201
v3 (feature): refactor logger middleware (#1979)
*  v3 (feature): refactor logger middleware
- Make middleware extandable for 3rd-party loggers. (https://github.com/gofiber/fiber/issues/1828)

*  v3 (feature): refactor logger middleware
- Make middleware extandable for 3rd-party loggers. (https://github.com/gofiber/fiber/issues/1828)

*  v3 (feature): refactor logger middleware

- add example for zerolog.

*  v3 (feature): refactor logger middleware

- fix ToC.

* merge
2022-09-05 13:15:42 +02:00
Muhammed Efe Çetin 319b8ea3a8
Merge remote-tracking branch 'origin/master' into v3-beta 2022-09-03 23:56:45 +03:00
Fufu 87faeda5c1
🐛 Fix: EnvVar middleware parses base64 incorrectly (#2069)
* Fix: EnvVar middleware parses base64 incorrectly

* Chore: fix typo in README.md

* Chore: standardize and simplify response
2022-09-03 19:03:51 +02:00
RW ec96d161a0
Fix csrf middleware behavior with header key lookup (#2063)
* 🐛 [Bug]: Strange CSRF middleware behavior with header KeyLookup configuration #2045
2022-08-30 14:48:31 +02:00
RW 0ebc9113d5
Update README.md 2022-08-30 08:36:17 +02:00
Emre Savcı d9257c2c1d
🚀 [Feature]: add envvar expose middleware (#2054)
* add envvar expose middleware

* fix readme remove redundant word

* change hard coded json marshal to app config marshaller

* update readme

* update all lang readme

* change t.setenv to os.setenv as backward compability reason

* change io.readall to ioutil.readall

* Update envvar.go

* remove get method that only used in test

* remove unused method from envvar struct

* remove path variable from config, update readme, add new test case

Co-authored-by: RW <rene@gofiber.io>
2022-08-30 08:30:13 +02:00
Jason McNeil 6272d759eb
🚀 [Feature]: middleware/csrf custom extractor (#2052)
* feat(middleware/csrf): allow custom Extractor

* test: update Test_CSRF_From_Custom

* docs: add comma

* docs: update KeyLookup docs
2022-08-28 18:57:47 +02:00
Amir Hossein ffb2d4cb1a
fix unhandled error in cache package tests (#2049)
* fix unhandled errors

* fix unhandled error in cache package test

* omit variable type

* omit variable type

* rename variable because collide with the imported package name
2022-08-26 14:10:46 +02:00
Trim21 c964fda009
v3(tests): use testify for assertion (#2036)
* replace

* write

* rewrite more

* rewrite

* rewrite

* fix

* rewrite
2022-08-22 07:57:10 +02:00
Trim21 b161f805c2
v3(enhancement): remove `utils.Trim*` (#2030)
stdlib functions have same performance in go1.19
2022-08-20 13:52:09 +08:00
Jinquan Wang 32d311cd59
🐛 monitor middleware - fix ignore custom settings (#2024)
* 🐛 fix: ignore custom settings

* 🐛 fix: ignore custom settings

*  chore: add tests for config default
2022-08-19 15:09:16 +02:00
Muhammed Efe Çetin 4105b008c2
Merge remote-tracking branch 'origin/master' into v3-beta 2022-08-19 14:33:31 +03:00
M. Efe Çetin 6669ec4486
📝 docs: gofmt & add missing copyright texts (#2013) 2022-08-15 20:25:26 +02:00
Jinquan Wang e8a2ba363c
🐛 bug: fix proxy overwrote the wrong scheme (#2004)
* 🐛 bug: fix proxy overwrote the wrong scheme

*  fix: fix io not exist in go1.14
2022-08-09 16:14:41 +02:00
Muhammed Efe Çetin f3067c14b3
🔥 v3: remove monitor middleware from core to reduce deps 2022-08-08 11:22:28 +03:00
M. Efe Çetin eacde70294
v3 (feature): initial support for binding (#1981)
*  v3 (feature): initial support for binding

*  v3 (feature): initial support for binding #1981
use pointer/references instead of copies

*  v3 (feature): initial support for binding
embed bind into the ctx

*  v3 (feature): initial support for binding
- add URI binder.

*  v3 (feature): initial support for binding
- add response header binder.

*  v3 (feature): initial support for binding
- add response header binder.

*  v3 (feature): initial support for binding
- add cookie binder.

*  v3 (feature): initial support for binding
- custom binder support for body binding.
- test case for custom binder.

*  v3 (feature): initial support for binding
- add map[string][]string & map[string]string support for binders.

*  v3 (feature): initial support for binding
- fix Test_Bind_Header_Map

*  v3 (feature): initial support for binding
- Functional Should/Must

*  v3 (feature): initial support for binding
- custom struct validator support.

*  v3 (feature): initial support for binding
- README for binding.
- Docs for binding methods.

*  v3 (feature): initial support for binding
- Bind() -> BindVars(), Binding() -> Bind()

*  v3 (feature): initial support for binding
- fix doc problems

*  v3 (feature): initial support for binding
- fix doc problems

Co-authored-by: wernerr <rene@gofiber.io>
2022-08-08 09:16:08 +02:00
Muhammed Efe Çetin 738e710766
♻️ v3 (enhancement): use fs.FS as Filesystem type of favicon middleware 2022-08-07 19:06:05 +03:00
M. Efe Çetin 4103f9463d
feature: customizable colors (#1977)
*  feature: customizable colors

*  feature: customizable colors

*  feature: customizable colors
2022-08-01 08:24:37 +02:00
RW ff1e0109a3
Closes #1931 "🤗 How to get path param before a custom verb?" (#1983)
* Add possibility for parameters before custom verb
FIX for "🤗 How to get path param before a custom verb? #1931"

* try to stabilize the tests
2022-07-27 08:37:03 +02:00
M. Efe Çetin a458bd344c
v3 (feature): convert fiber.Ctx type to interface (#1928)
*  v3: convert fiber.Ctx type to interface

* update ctx methods

* add new methods to customize ctx, fix some problems

* update comments.

* fix something
2022-07-13 07:48:29 +02:00
Majid Taheri(I love optimization) 744e4da3ef
add some parameters to config for supporting #1936 (#1956)
* add some parameters to config for supporting #1936

* remove go:embed

* apply code review  - 1956#issuecomment-1169811117

* lint

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2022-07-05 13:34:32 +02:00
marcelogamba e58ad6b69a
TagLatency doesn't have consistence format between default and custom format (#1943)
Co-authored-by: Marcelo Gamba <gamba@itstransdata.com>
2022-07-04 09:14:57 +02:00
John Li 41d31a0190
fix middleware/session update cookie. (#1960) 2022-07-02 13:02:41 +02:00
Muhammed Efe Çetin a2c71e548e
v3: include adopter, helmet, keyauth, redirect, rewrite middlewares into the codebase (https://github.com/gofiber/fiber/issues/1828) 2022-06-21 17:36:59 +03:00
Muhammed Efe Çetin 67b9542f3f
v3: rename protocol to scheme, add protocol to ctx (https://github.com/gofiber/fiber/issues/1828) 2022-06-21 17:24:34 +03:00
Muhammed Efe Çetin 3b943d79c9
v3: remove internal/template/html, replace internal/memory by internal/storage/memory 2022-06-04 14:19:59 +03:00
Muhammed Efe Çetin 8a15f77fc4
v3: move most deps to go.mod 2022-06-02 17:37:53 +03:00
Muhammed Efe Çetin f119794035
v3: replace io/ioutil by io and os, update version constant 2022-06-01 18:34:22 +03:00
Muhammed Efe Çetin 9efcefa513
v3: fix tests 2022-05-31 17:55:08 +03:00
Muhammed Efe Çetin edd89de2d6
v3: remove deprecations 2022-05-31 17:50:31 +03:00
Muhammed Efe Çetin c7f45ec38e
v3: replace interface{}s by any 2022-05-31 17:41:38 +03:00
Muhammed Efe Çetin 1188144d78
🎉 v3: init 2022-05-31 17:35:49 +03:00
Viktor Persson 68e922d733
Refactor favicon middleware, avoid magic numbers. (#1919)
* Refactor favicon middleware, avoid magic numbers.

* Introduce constant for path to favicon.
2022-05-28 21:35:49 +02:00
Serhat Şevki Dinçer 0fdd7df0f9
📊 add refresh period to monitor mw (#1898) 2022-05-16 08:15:47 +02:00
Vladislav aa229287cf
🔥 Feature: Add max size to cache (#1892)
* Cache middleware size limit

* Replace MaxInt with MaxInt32. Add comments to benchmark

* Avoid allocation in heap push. Small fixes

* Count body sizes instead of entries

* Update cache/readme
2022-05-10 08:50:26 +02:00
Serhat Şevki Dinçer 29be6691c5
📊 add page title to monitor mw (#1893) 2022-05-05 15:27:48 +02:00
Pinank Solanki bb9ac8feaf
🐛 Fix expiration time in cache middleware (#1881)
* 🐛 Fix: Expiration time in cache middleware

* Custom expiration time using ExpirationGenerator is also functional
now instead of default Expiration only

* 🚨 Improve Test_CustomExpiration

* - stabilization of the tests
- speed up the cache tests
- fix race conditions in client and client tests

Co-authored-by: wernerr <rene@gofiber.io>
2022-05-01 11:43:46 +02:00
akp e974c6793f
RFC: Return an instance of `*fiber.Error` when no handler found (#1847)
* Return an instance of `*fiber.Error` when no handler found

When a handler cannot be found for a given path, previously Fiber
would construct a plaintext response that cannot be modified.

This commit switches to returning a new instance of `*fiber.Error`
with identical error message so that users can customise the look
of their 404 pages.

Signed-off-by: AKP <tom@tdpain.net>

* Fix `Test_App_Next_Method`

This test was failing as the error returned by `c.Next()` that's
required to generate the correct 404 status code was not being
passed through the middleware and being silently ignored.

Signed-off-by: AKP <tom@tdpain.net>

* Fix `Test_Logger_All`

Signed-off-by: AKP <tom@tdpain.net>

* Fix `Test_Cache_WithHeadThenGet` test

As far as I can tell, this test is meant to check that a cached
HEAD request to a given endpoint does not return the cached
content to a GET request to the same endpoint, and the test has
been altered to correctly check for this.

Signed-off-by: AKP <tom@tdpain.net>
2022-04-05 08:39:53 +02:00
Vadim Gerasimenko c92a5056ae
🩹 Fix limiter middleware db connection (#1813)
* remove release() method

* Revert "remove release() method"

This reverts commit fdfc8da967.

* Rearrange mutexes in limiter_fixed.go

* refactor limiter_fixed.go

* Update limiter_fixed.go

Co-authored-by: RW <rene@gofiber.io>
2022-03-15 12:41:28 +01:00
Théotime Lévêque 1cddc56f13
Cache middleware: Store e2e headers. (#1807)
*  Cache middleware: Store e2e headers.

As defined in RFC2616 - section-13.5.1, shared caches MUST
store end-to-end headers from backend response and MUST be
transmitted in any response formed from a cache entry.

This commit ensures a stronger consistency between responses
served from the handlers & from the cache middleware.

*  Cache middleware: Add flag for e2e headers.

Set flag to prevent e2e headers caching to
be the default behavior of the cache middleware.
This would otherwise change quite a lot the
experience for cache middleware current users.

*  Cache middleware: Add Benchmark for additionalHeaders feature.

*  Cache middleware: Rename E2Eheaders into StoreResponseHeaders.

E2E is an acronym commonly associated with test.
While in the present case it refers to end-to-end
HTTP headers (by opposition to hop-by-hop), this
still remains confusing. This commits renames it
to a more generic name.

*  Cache middleware: Update README

*  Cache middleware: Move map instanciation.

This will prevent an extra memory allocation for users
not interested in this feature.

*  Cache middleware: Prevent memory allocation when StoreResponseHeaders is disabled.

*  Cache middleware: Store e2e headers. #1807
- use set instead of add for the headers
- copy value from the headers -> prevent problems with mutable values

Co-authored-by: wernerr <rene@gofiber.io>
2022-03-08 10:18:04 +01:00
Théotime Lévêque d0934df656
✏️ Cache middleware: Fix comment typo in manager.go. (#1804) 2022-03-05 15:36:51 +03:00
Geet Manghnani a746e5bfb8
Restore Original URL of the context after changing it (#1788)
* Restore original URL after the proxy

* Use the Immutable string to restore

* Changing deprecated ImmutableString to CopyString

Co-authored-by: Geet Manghnani <gmanghna@in.ibm.com>
2022-02-20 21:59:47 +01:00
Vadim Gerasimenko c5f11cc800
Fix comment relating to deprecated field (#1790) 2022-02-20 19:01:16 +03:00
bigflood e3d258655f
Fix: incorrect scheme on proxy.Do (#1762) (#1765) 2022-02-12 19:43:04 +01:00
liaohongxing 1fd6eabba9
fix cache docs error (#1769) 2022-02-12 13:00:00 +01:00
apoq b9efc76722
Fix cache mutex lock (#1764) 2022-02-11 09:48:52 +01:00
Abhishek Mehandiratta 68fcd8c88f
Feature: Session Only Cookies (#1752)
* feat(ctx): add SessionOnly property on Cookie struct

* feat(middleware/config): add CookieSessionOnly property on middleware Config struct

* feat(csrf): link config CookieSessionOnly with fiber.Cookie in create middleware function

* fix(ctx_test): add tests for SessionOnly cookie in test_ctx_cookie

* fix(readme): update readme in csrf middleware for CookieSessionOnly property

* remove deprecated property from CookieSessionOnly explaination comments
2022-02-07 13:35:00 +01:00
Norbert Hauriel 569511eb78
📝 fix file names (#1747) (#1748) 2022-02-03 12:58:59 -05:00
Norbert Hauriel d85ae2bce3
Doc(limiter): clarify variable name 'expire' (#1742)
This clarifies the intent of variable 'expire' by renaming to
the more understandable 'resetInSec'. All mentions are renamed as well.
2022-02-03 09:26:25 +01:00
M. Efe Çetin 5766feef29
feature: add Next to Pprof and Expvar middlewares. (#1737)
* Add Next to Pprof and Expvar middlewares.

* Update READMEs.
2022-01-29 22:24:32 +01:00
Jesse Quinn d411ec10d6
added HEAD method to caching (#1730)
* added HEAD method to caching

* changed key due to head and get sharing same key

* Update cache.go

- add a improvement task for later

* Update cache.go

correct comment

Co-authored-by: Jesse Quinn <jesse.quinn@zpesystems.com>
Co-authored-by: RW <rene@gofiber.io>
2022-01-24 16:36:46 +01:00
Nick Smith 1b00264385
Fix typos in middleware (#1714)
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-01-14 22:31:44 -05:00
amir 4f1a712498
🩹 Fix: Add `csrf_` to default encrypt cookie exception (#1631) (#1698) 2022-01-09 22:21:49 +01:00
M. Efe Çetin 59240b5493
Add GetRespHeader, GetReqHeaders and TagReqHeaders for logger mw (#1678)
* Add GetRespHeader & GetReqHeaders methods.

* Add TagReqHeaders for logger middleware.

* Update README.md
2021-12-31 13:03:08 +01:00
Jason McNeil 59e4bf6cc5
🔧 fix(middleware/csrf): unmatched token returns nil error (#1667)
* Update csrf.go

* Update csrf_test.go

* fix(middleware/csrf): missing token return and unit test

* Update csrf_test.go
2021-12-29 02:13:20 +01:00
wernerr a5b2b8989b fix middleware/session README.md 2021-12-06 13:35:47 +01:00
M. Efe Çetin 5e37126352
Improvements for logger middleware (#1645)
* Add NO_COLOR compatibility.

* Use /dev/stdout as default output stream.

* Fix coloring with custom formats.

* Fix tests.
2021-12-06 08:21:36 +01:00
M. Efe Çetin b74676704d
Add disable html support to monitor middleware. (#1620)
* Add disable html support to monitor middleware.

* Change field.

* Update README.md

* Update middleware/monitor/config.go

* Fix tests.

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
2021-12-05 19:28:50 +01:00
Jason McNeil 693f3c5118
fix(middleware/session): CookieSameSite default "Lax" (#1638)
* CookieSameSite default "Lax"

* Update README.md

* CookieSameSite default "Lax"

* Revert "CookieSameSite default "Lax""

This reverts commit 414187704b.
2021-12-02 07:44:03 +01:00
Jason McNeil af6b204e50
CookieSameSite default "Lax" (#1640) 2021-12-02 07:41:44 +01:00
Turgay c9e959c4d4
Recover middleware: Added, fiber.Ctx as a first paremeter to StackTraceHandler. (#1623) 2021-11-29 08:31:43 +01:00
djunny f9d5f787af
Feature: [Cache] add ExpirationGenerator for generate custom Expiration (#1618)
* Feature: [Cache] add ExpirationGenerator for generate custom Expiration

* fix: add document and code snippet for README

Co-authored-by: dj <github@djunny.com>
2021-11-11 11:30:38 +01:00
Gusted 7b7dcf29f7
♻️ Tidy up the codebase (#1613)
* run gofmt

* add t.Helper()

* Simplify assigns

* Simplify make operation

* Remove unused field in struct

* Fix typo

* Run gofumpt ./

* Consistent spacing

* len(...) can never be negative

* Use ReplaceAll

* Simplify operation

* Remove deadcode

* Fix typo

* Tidy up `} else { if ...`

* Fix AssertEqual

* Remove t.Helper() to fix go1.14.15
2021-11-05 08:00:03 +01:00
liaohongxing a6aea1cdc5
fix cache docs error (#1612) 2021-11-03 16:49:26 +01:00
RW acc32db005
🐛 Session Id immutable (#1601)
Close #1585
2021-10-28 08:23:56 +02:00
Michael Weiss 743d8ec08c
Fix comment (#1597)
When merging #1310, the corresponding adaptation of a code comment appears to have gone forgotten.
2021-10-25 18:37:50 +02:00
Gusted 36796ee7a1
fix: remove `Test_Limiter_Cheat` test (#1595) 2021-10-25 07:04:56 +02:00
RW ff38081eb9
Fix - Etag README.md (#1584)
* Fix - Etag README.md

* Fix - Etag README.md
2021-10-19 11:36:16 +02:00
Gusted e6feb36827
feat: add sliding window as option for limiter middleware (#1580)
- Add the options to use your own middleware(should be more modular over time).
- Add the Sliding window option(see #1247)
- A little bit better polished version of #1247.
2021-10-18 09:13:53 +02:00
James Li c49940730d
chore(docs): fix example encoding issue in READMD.md of logger middleware (#1576)
Co-authored-by: James3 Li(李麒傑) <james3_li@asus.com>
2021-10-18 09:13:32 +02:00
IvanK Production 92a811c93e
Fix "Signaures" (expect "Signatures") word in middleware/encryptcookie/README.md (#1577) 2021-10-16 12:43:10 -04:00
Ali Eren Öztürk 9c37b4c1c5
Fix limit middleware skip options (#1568)
* fix limit middleware skip options

* fix limiter middleware remaining count

* used constant StatusBadRequest instead of int 400
2021-10-11 18:31:37 +02:00
Jose Garcia 587f3ae9df
Support for sub fiber's error handlers (#1560)
- Mounted fiber and its sub apps error handlers are now saved a new
  errorHandlers map in App
- New public App.ErrorHandler method that wraps the logic for which
  error handler to user on any given context
- Error handler match logic based on request path <=> prefix accuracy
- Typo fixes
- Tests
2021-10-05 14:03:20 +02:00
Fufu 8b3a06b164
Fix: file opening path and directory browsing path of filesystem (#1547)
* Fix: file opening path and directory browsing path of filesystem

* Update: utils.TrimRight instead of strings.TrimSuffix
2021-09-29 19:53:25 +02:00
Amal Shaji afa53ae1f6
support logging color for custom logging formats (#1513) 2021-09-28 10:11:44 +02:00
Ali Eren Öztürk 2aef5f8e01
limiter middleware new options: SkipFailedRequests, SkipSuccessfulRequests (#1542) 2021-09-28 10:10:29 +02:00
M. Efe Çetin c0c14671ba
Add one minute load avg for monitor. (#1530)
Fix CI/CD errors.

Fix Windows.

Fix Windows.

Fix golint error.
2021-09-22 08:29:44 +02:00
RW 2272e4a6b1
🐛 Get unexpected results from cache #1529 (#1531) 2021-09-15 14:20:43 +02:00
M. Efe Çetin 76b0d216c1
Add next support for Monitor middleware. (#1527) 2021-09-13 08:51:44 +02:00
RW 4096e72008
update logger readme 2021-08-31 12:48:56 +02:00
wernerr 426520b671 update encryptcookie documentation 2021-08-24 08:52:32 +02:00
wernerr ca3696624d correct documentation for the skip middleware 2021-08-24 08:38:15 +02:00
Bhurinat Wangsutthitham 0e08bb4fe7
🐛 session should not regenerate the ID in case Get() returned nil (#1493)
* fix: session should not regenerate the ID in case Get() returned nil

* fix: prevent falsy unit-tests

* docs: improve wordings on tests
2021-08-23 08:32:14 +02:00
amir bff8843abd
🔥 Feature: Add encrypt cookies middleware (#1343)
* 🔥 Feature: Add encrypt cookies middleware

* Encrypt cookies when error happens

* Improve encrypt cookie middleware

* Fix errors

* Update encryptcookie config doc blocks

* Change `SetCookie` to `SetCookieBytesKV` for invalid cookies

* Update middleware/encryptcookie/config.go

* Update README.md

* Remove `GenerateKey` parameter

* Update README.md

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
2021-08-23 08:31:51 +02:00
thinklucrative 9a7b08ee23
Update README.md (#1472)
Typo:
var ConfigDefault = Config{
	KeyLookUp:    "cookie:session_id",
}

should be:
var ConfigDefault = Config{
	KeyLookup:    "cookie:session_id",
}
2021-08-05 20:14:32 +02:00
András Czigány 5f1acd3c56
🔥 Feature: Add Skip middleware (#1465)
* add Skip middleware

* middleware/skip: fix test expectations
2021-08-04 10:05:29 +02:00
goldwind-ting 846d5a5b38
[Logger]: add tag for response header (#1446)
* add TagRespHeader to get response header

* #1422:add unittest

* #1422:adjust docs for logger middleware

* #1422:adjust docs for logger middleware
2021-08-04 08:19:41 +02:00
RW d777d889bb
Fix cache expired test (#1461)
* Improve/Stabilize the "Test_Cache_Expired" test run
2021-07-30 20:19:18 +02:00
Marcos de Oliveira 30ba99425f
Add ${port} logger variable (#1448)
* Add c.Addr() and c.Port() functions and logger port variable

* Add gofmt suggestion, README.md description and test

* Remove c.Addr() func and use c.fasthttp.RemoteAddr() instead
2021-07-22 17:42:29 +02:00
HugHunter 7cd8219420
Update README.md (#1444)
spotted a small mistake in the docs
2021-07-19 12:51:03 +02:00
Kazumasa Takenaka (Bamboo) f5338266e3
fix typo (#1442)
paramters -> parameters
avilable  -> available
seperated -> separated
2021-07-17 17:20:14 +02:00
Spedoske cd802dfead
Fix: copy the data in buffer instead of using original data. (#1425) 2021-07-11 12:35:02 +02:00
Spedoske e082880297
Fix: Session middleware issues (#1407)
* Update session.go

Fix: Session.Regenerate does not set Session.fresh to be true.

* Fix: Session should be regenerated if the session can not be found in the storage
https://github.com/gofiber/fiber/issues/1408

* Add test for session and store in session middleware.

* Clean up code

* Update middleware/session/session.go

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
2021-06-30 08:01:22 +02:00
tuhao1020 93dc33ad89
add tls config for http client in proxy middleware (#1393)
* add tls config for http client in proxy middleware

* update exmaple and make tls.config also affects to proxy.Balancer

* add Test_Proxy_Forward_WithTlsConfig

* add a variable of type *tls.Config

* add a RWMutex for clientTlsConfig

* remove global tls config

* Update README.md

* Update proxy.go

Co-authored-by: RW <rene@gofiber.io>
2021-06-24 08:13:18 +02:00
Javad Rajabzade 7609117cec
Improved some conditions (#1386)
* simplify `u <= (1<<7)-1` to `u < (1 << 7)`

* It's not recommended to use `len` for empty string, we can check with string with ""

* It's not recommended to use `len` for empty string, we can check with string with ""

* It's not recommended to use `len` for empty string, we can check with string with ""

* It's not recommended to use `len` for empty string, we can check with string with ""

* Instead Bool comparison can using simplified bool check if !var = false checking

* Unnecessary use of fmt.Sprintf for value without format

* For check condition two value not required ! method

* nil check may not be enough for slice, better check with len

* function parameters combined

* When the form returns error information, the text content should not start with a capital letter or end with a punctuation mark

* error var invalidPath should have name of the form errFoo, It is recommended that the error variables that are part of an API should be named

* change to condition len(x), it's faster https://github.com/gofiber/fiber/pull/1386#discussion_r652369520

* Update write.go

* Update write_bytes.go

* Update store.go

Co-authored-by: RW <rene@gofiber.io>
2021-06-17 22:03:59 +02:00
João Victor Santos c08568e247
🔥 feat: expiration per session (#1363)
* feat(middlewares): expiration per session

* test(middlewares): session with expiration

* docs(middlewares): session

* chore: apply suggestions from code review
2021-06-13 12:39:19 +02:00
Wei Lun bca01cc9cc
🔥 Feature: add cache header to show cache status (#1368)
* add cache header to show cache status

* update default CacheHeader to X-Cache

* add CacheHeader test

* Update cache_test.go

use constants in test

Co-authored-by: RW <rene@gofiber.io>
2021-06-13 10:52:03 +02:00
hi019 a7d9c6816e
Fix session delete when there is one key (#1366)
* Add regression test, attempt solution

* Attempt 2
2021-06-05 20:15:06 +02:00
RW 8e89949381
🚀 Configure proxy.Balancer with custom timeout #1362 (#1364)
* 🚀 new possibility to escape special routing parameters, which gives the possibility to follow the google api design guide https://cloud.google.com/apis/design/custom_methods

* 🚀 new possibility to escape special routing parameters, which gives the possibility to follow the google api design guide https://cloud.google.com/apis/design/custom_methods

* 🚀 Configure proxy.Balancer with custom timeout or client #1362

* 🚀 Configure proxy.Balancer with custom timeout or client #1362
2021-06-04 16:54:03 +02:00
bestgopher 2d6323c197
:fix #1360 (#1361) 2021-06-03 16:02:17 +02:00
Costa bad3abb8ed
fix comments in proxy middleware (#1355)
fix a little comment wrong in proxy middleware
2021-06-01 08:34:33 +02:00
LeoZhan 9b3662eae0
🔥 Customize the source of session_id (#1159)
* 🔥 Feature: Define KeyLookup configuration (#1110)

* 🔥 Feature: Allow session ID to be written in header (#1110)

* 🔥 Feature: Allow session ID to be obtained from different sources (#1110)

* 📚 Doc: Add Source configuration (#1110)
2021-05-29 02:48:25 +02:00
João Victor Santos 0de49175c7
feat(middlewares): session keys (#1337)
*  feat(midlewares): session keys

- added a sess.Keys() method who retrive all keys from current session

* docs(middlewares): session
2021-05-23 08:45:33 +02:00
bestgopher 2f05108351
fix pprof redirect path (#1330)
* 📒:fix redirect path

* ️:fix test case

* 📚:use constant instead of number

* 🔥:TrimRight instead of TrimSuffix
2021-05-19 12:47:07 +02:00
sadfun 547bdb1c23
Change deprecated struct elements (#1335)
Duration and Store are deprecated, so we should show Expiration and Storage in example
2021-05-18 10:56:55 +02:00
Tom 21c9fb4936
🔥 Add `PathPrefix` parameter to `filesystem` middleware (#1326)
See #1308

This adds a parameter called `PathPrefix` to `filesystem.Config`
that is prepended to any filepath being read from
`filesystem.Root`.

Intended to be used with Go 1.16's `embed.FS` type.

Signed-off-by: Tom <tom@tdpain.net>
2021-05-12 08:58:01 +02:00
Yash Garg e7d5759733
📝update handler example in timeout (#1328) 2021-05-10 10:48:07 -04:00
Ivan Sotnikov 15cb3dc025
🐛 Cache Middleware - Race condition in the cache expiration logic. Round 2 (#1310)
* 🐛 fix: decrease watchdog period time
2021-05-04 09:18:48 +02:00
Sepehr Rafiei a95e371920
🐛 Print logger's error to stderr if given io.writer failed (#1299)
Co-authored-by: Sepehr Rafiee <sepehr.rafiee@snapp.cab>
2021-04-25 10:32:35 +02:00
kiyon 3b9f78a02d
Merge pull request #1288 from fernandobandeira/master
 Etag middleware support to custom etags
2021-04-22 19:40:37 +08:00
Jean-Sébastien Ney c3aafde9db
[middleware/proxy] add buffer size configuration (#1292)
* add buffer size

* add tests
2021-04-20 12:56:00 +02:00
Fernando Bandeira 72c84639be Etag middleware support to custom etags 2021-04-18 23:08:01 -03:00
Nik Schaefer 12b57db688
📚 Doc: Correct cors to favicon in import statement (#1279) 2021-04-11 21:07:31 +02:00
Nik Schaefer a6868c24b9
📚 Doc: Correct Session to Crsf in Import (#1277) 2021-04-10 16:19:40 -04:00
Sagar Sonwane ecfcf1cc00
♻️ Removed Printed Warning (#1268)
* ♻️ Removed Printed Warning

removed print statement for warning from monitor.go file

* 📝 Added Warning Message in Readme

added warning message in monitor middleware readme
2021-04-06 15:21:53 +02:00
SianLoong c71da35ddb
🐛 fix: even error we gonna to unlock it, else it will went deadlock (#1248) 2021-03-30 23:40:09 +02:00
Roman ca0e784fb9
Refactor cache middleware to not-use the deprecated methods (#1246)
* ♻️ refactor: cache: don't use the deprecated `SafeBytes` and use `CopyBytes` instead

* ♻️ refactor: utils: remove deprecated and unused methods
2021-03-30 23:31:03 +02:00
RW b1b490645e
Fix session middleware (#1235)
encoding/gob for session middleware
2021-03-26 11:24:55 +01:00
iRedMail 7537390be0
Add a TODO item to remind implementing a breaking change in fiber v3. 2021-03-20 13:36:22 +08:00
iRedMail 078b6e295a
Fix comment in middleware/csrf/config.go 2021-03-20 12:58:08 +08:00
iRedMail e2fd329f1e
Fix incorrect comment in middleware/session/config.go 2021-03-20 12:55:39 +08:00
Ivan Sotnikov d9c13d3442
🐛 Set expiration time in test to 1.5 due to the timer error (#1229) 2021-03-19 19:10:53 +01:00
Ivan Sotnikov b517de85ec
🐛 update expiration for expired entry (#1228) 2021-03-17 08:08:44 +01:00
Zuolar 4dcb490489
fix logger [WARNING: DATA RACE] (#1226)
* fix logger [WARNING: DATA RACE]
* add logger unit test for data race
2021-03-17 08:08:15 +01:00
Joey 0f18e0f1b0
Merge pull request #1194 from gofiber/csrf-mw-restructuring
CSRF MW Restructuring
2021-03-09 15:32:16 +01:00
hi019 13f0d5bb61 Remove global variable 2021-03-09 09:29:47 -05:00
iRedMail a179c6665c
✏️ FS MW: add example of embedding directory (#1197)
Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
2021-03-02 12:12:40 -05:00
hi019 983919fd18
CSRF Docs - Add note about how to get token (#1196) 2021-03-01 20:32:22 -05:00
hi019 b31953ab8d Revert "Remove global variable"
This reverts commit 2d4d2f7c
2021-03-01 16:38:56 -05:00
hi019 2d4d2f7c47 Remove global variable 2021-03-01 16:30:04 -05:00
hi019 86e43593cd CSRF MW Restructuring 2021-03-01 16:25:32 -05:00
Jason McNeil 53e5dc523e
🩹 Fix: CSRF middleware cookie<>storage bug squashed and other improvements (#1180)
* expire cookie on Post, Delete, Patch and Put

Cookie should always expire on Post, Delete, Patch and Put as it is either valid and will be removed from storage, or is not in storage and invalid

* token and cookie match

* retrigger checks

* csrf tests

* csrf per session strategy
2021-03-01 17:44:17 +01:00
tianjipeng 59b12fbcb2
fix: lookup cookie in response header (#1191) 2021-03-01 17:25:36 +01:00
Andrew DeChristopher 13c4245242 🔥 Fix favicon filesystem tests
This change exists to support go 1.16 embedded filesystems and other network filesystems that can't simply be read as a file from a system path.
2021-02-24 12:27:32 -05:00
Andrew DeChristopher 6a5698277c 🔥 Add optional FileSystem config to favicon middleware
This change exists to support go 1.16 embedded filesystems and other network filesystems that can't simply be read as a file from a system path.
2021-02-24 11:42:54 -05:00
kiyon 0d8fa6bf63
Merge pull request #1187 from kiyonlin/improve-proxy-test
👷 Improve proxy middleware test case
2021-02-23 16:28:14 +08:00
Kiyon 1a67fdb343 👷 Improve proxy middleware test case
- add t.Parallel()
- use random port
2021-02-23 15:32:27 +08:00
circa10a c1386ff6c5 📝 docs: add embed example for go 1.16 2021-02-18 09:38:05 -06:00
Joey 557023f399
Merge pull request #1150 from cornerot/patch-1
🐛 Fix setting host header in proxy middleware
2021-02-17 14:12:38 +01:00
RW 7d51885384
📚 fix wrong session code example (#1170)
📚 fix wrong session code example
2021-02-16 14:50:17 +01:00
cornerot 0e2e04b9ba
add fasthttp.LBClient to the proxy middleware 2021-02-04 23:04:11 +03:00
Joey 66c457d5c8
Merge pull request #1135 from tianjipeng/fix/cache
ajust config.Next position
2021-01-31 07:55:25 +01:00
tianjipeng 08a2e7a82d ajust cache middleware config.Next position 2021-01-26 10:26:13 +08:00
Joey e332d54b29
Merge pull request #1134 from ReneWerner87/improve_bootstrap_for_many_routes
 Accelerate start process for many routes #1081
2021-01-25 15:40:35 +01:00
Joey b03b596a59
Merge pull request #1132 from xenowits/master
Reference to issue #1115
2021-01-25 15:39:43 +01:00
Joey a9b648eda8
Merge pull request #1131 from tianjipeng/master
🔥 Feature: recover middleware support print stack trace
2021-01-25 15:38:35 +01:00
Abhishek Kumar cae82d0a2f 🩹 Fix: fix test for response body 2021-01-24 15:00:51 +00:00
Abhishek Kumar e8c3a0fac3 🩹 Fix: add separate test for resBody logger variable 2021-01-24 13:11:46 +00:00
ReneWerner87 42755c30e6 Accelerate start process for many routes #1081 2021-01-24 13:02:21 +01:00
RW 9b3d86098b
📖 fix style 2021-01-24 12:42:22 +01:00
Abhishek Kumar 94589e2348 Merge local changes 2021-01-24 11:21:36 +00:00
Abhishek Kumar 9c18716885 🔥 Feature: add proper tests for new logger variables 2021-01-24 11:21:10 +00:00
xenowits 2b36972d81 🩹 Fix: adjust tab spaces in logger README 2021-01-24 15:49:08 +05:30
xenowits 2a1c717448 🩹 Fix: add new variables to README 2021-01-24 15:41:46 +05:30
xenowits dc1727fcc7 fix: spacing in logger variables - issue #1115 2021-01-23 23:04:28 +05:30
Abhishek Kumar 7c36b32194 🩹 Fix: reference to logger issue #1115 2021-01-23 17:19:33 +00:00
bluetian 5adafe2ecb recover middleware support print stack trace 2021-01-23 13:33:49 +08:00
hinoguma 1ad5a618cb make default handler to private. fix testcase for invalid token and empty token. 2021-01-23 12:39:27 +09:00
hinoguma 19e6a4429d add custom error func for csrf middleware 2021-01-23 03:45:47 +09:00
Hítalo Silva bba55cf240
Added total RAM to counters 2021-01-21 18:29:29 -03:00
bestgopher 90acced7c1 fix some statements 2021-01-15 16:56:54 +08:00
bestgopher 07563a1845 fix timing attack 2021-01-15 15:59:13 +08:00
JeffProd 22bbfead6f
Update README limiter 2020-12-26 14:22:17 +01:00
hi019 494474aebd
Merge branch 'master' into master 2020-12-13 22:08:51 -05:00
amalshaji 86f258c4ae fixed cookie error in csrf.go 2020-12-10 10:45:21 +05:30
Fenny 6dcbdf4e85 🧹 remove invalid config 2020-12-09 01:29:42 +01:00
Fenny 142e6e53be 🩹 fix #1055 2020-12-06 16:43:24 +01:00
Fenny 0fe30ac722 🌀 introduce RegisterType 2020-12-06 16:37:08 +01:00
Fenny 19bee02563 🩹 draft for #1051 2020-12-03 11:56:32 +01:00
Fenny e28c886d73 🩹 fix internal memory storage 2020-12-03 11:14:33 +01:00
Fenny cd029a67a7 🩹 fix #1050 2020-12-03 11:07:15 +01:00
nupamore 65a57d194a fix: set cookie order 2020-12-02 15:34:16 +09:00
Joey 41d797c990
Merge pull request #1045 from Fenny/master
🔐 use uuid v4 in session
2020-11-30 14:37:17 +01:00
Fenny 7be78406cb 🔐 use uuid v4 in session 2020-11-30 14:31:10 +01:00
Joey 570f7ac3b4
Merge pull request #1042 from Fenny/master
🩹 fix empty CookieName in session
2020-11-28 08:23:46 +01:00
Fenny d56ca11be8 🩹 fix empty CookieName in session
See https://github.com/gofiber/fiber/issues/1040
2020-11-27 16:36:22 +01:00
Joey 51a62a39aa
Merge pull request #1038 from Fenny/master
✏ move mutex
2020-11-26 22:36:38 +01:00
Fenny 45d64da9fa 🍿 move mutex 2020-11-26 22:33:35 +01:00
Fenny a0442be8b6 ✏ move mutex 2020-11-26 22:16:49 +01:00
Joey 05bfe1b83b
Merge pull request #1032 from Fenny/master
📦 update version
2020-11-26 16:44:56 +01:00
Fenny 450bf14c3d 🩹 fix test 2020-11-26 16:38:35 +01:00
Fenny 418d82e4d1 🩹 fix test 2020-11-26 16:36:26 +01:00
Fenny 2b76fd6648 🩹 fix test 2020-11-26 15:27:05 +01:00
Fenny 3107a59469 💡 try rwlock 2020-11-26 13:54:55 +01:00
Fenny 52292babba 🩹 fix race condition 2020-11-26 12:19:05 +01:00
Fenny e1078f8716 🩹 fix #1030 2020-11-26 12:05:43 +01:00
Fenny 711911aeea 🩹 fix #1033 2020-11-25 13:10:01 +01:00
Joey 2e30da966a
Merge pull request #1025 from Fenny/master
📦 Update utils and middleware configs
2020-11-24 07:24:04 +01:00
Fenny 367fed6ebe 🩹 fix session mw 2020-11-23 08:44:34 +01:00
Fenny a468af7762 🩹 fix mutex lock 2020-11-23 07:44:06 +01:00
Fenny 323d9d89cc 🩹 fix manager logic 2020-11-23 07:38:42 +01:00
hi019 bc7b240158 improve mw 2020-11-21 12:36:16 -05:00
hi019 52ec20c3b4 do basicauth, cache and compress 2020-11-21 12:23:35 -05:00
Fenny 8fe458011d 📦 add mapstore 2020-11-20 11:43:07 +01:00
Fenny 6ded637712 🩹 update store logic 2020-11-18 09:02:42 +01:00
hi019 e828c17554 Standardize MW docs 2020-11-17 12:12:49 -05:00
Fenny f714660ca9 🩹 update mutex logic
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 13:15:32 +01:00
Fenny cf4f60e965 🩹 update lock
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 13:12:42 +01:00
Fenny 9d5b58d210 🩹 remove mutex
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 13:06:59 +01:00
Fenny a2f54222bb 🩹 remove return nil
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 13:05:17 +01:00
Fenny 9be8eedcc6 🩹 fix cache mw
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 13:03:18 +01:00
Fenny 56cf415a0a simplify storage handler
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 10:40:11 +01:00
Fenny bb3a7fe5da 🩹 fix cache
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 08:33:07 +01:00
Fenny e44da45bff 🩹 fix session test
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 08:15:22 +01:00
João Vitor 3df5ebbed6
changes request 2020-11-16 21:01:20 -03:00
João Vitor 7600e28cb9
update readme 2020-11-16 15:53:53 -03:00
Fenny de912755f7 📦 update session 2020-11-16 14:22:44 +01:00
Fenny 581cac04bc ✏ update session readme 2020-11-14 03:14:06 +01:00
Fenny 6338ce855c 🩹 fix csrf test 2020-11-14 03:09:53 +01:00
Fenny 9a0551049c 📝 update readme 2020-11-14 00:47:31 +01:00
Fenny 6b48509ce9 update cookie config fields 2020-11-14 00:45:55 +01:00
Fenny 558d802cdd 🩹 Fix expiration check 2020-11-13 18:34:01 +01:00
Fenny 27baab0ea0 🧨 introduce destroy 2020-11-13 18:30:14 +01:00
hi019 37dd02e4cb Comment out TODO test 2020-11-13 00:06:27 -05:00
hi019 edd9890518 Add session tests 2020-11-12 23:59:56 -05:00
Joey d1098d7057
Merge branch 'master' into master 2020-11-12 20:31:28 +01:00
João Vitor df78ede567
Update the readme, since Duration is deprecated (#1015)
* Update the readme, since Duration is deprecated

Chance to Expiration

* Update README.md

* Update README.md
2020-11-12 19:30:02 +00:00
Fenny e25206458d 🧪 add session test 2020-11-12 19:11:50 +01:00
Fenny ef35d00a79 🦺 simplify session config 2020-11-11 23:51:32 +01:00
Fenny ec8fdb32de 🧽 clean code structure 2020-11-11 21:44:37 +01:00
Fenny b29d500fc0 🩹 verify csrf on state changing methods 2020-11-11 21:39:22 +01:00
Fenny 2864657c76 ✏ update readme 2020-11-11 19:24:43 +01:00
Fenny 2cafd486ef ✒ update session logic 2020-11-11 19:22:40 +01:00
Fenny 75e3f13de1 ✏ update config 2020-11-11 18:49:07 +01:00
Fenny d8623ef53c ✏ fix comment 2020-11-11 18:45:04 +01:00
Fenny ce897c0b66 🩹 fix tests 2020-11-11 18:34:46 +01:00
Fenny 70a3a4dc21 🩹 fix limiter 2020-11-11 18:28:27 +01:00
hi019 52fad55267 Add more logger examples 2020-11-11 12:25:07 -05:00
Fenny 66ee4de7d8 🕊 rename token to key 2020-11-11 18:19:53 +01:00
Fenny 1bd7b1b15b ✏ fix typo 2020-11-11 16:41:26 +01:00
Fenny 2b0f65c5d2 ✏ update readme 2020-11-11 15:57:38 +01:00
Fenny 2a541b021c ✏ update csrf readme 2020-11-11 15:33:19 +01:00
Fenny 053dfd383d 🩹 fix crsf middleware 2020-11-11 15:25:35 +01:00
Fenny 687717f113 🛠 separate config 2020-11-11 14:03:16 +01:00
Fenny 8bd50de610 🧹 housekeeping 2020-11-11 13:54:27 +01:00