1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-20 22:12:56 +00:00

553 Commits

Author SHA1 Message Date
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 fdfc8da967204f58f0342a5141a00cc07e1cccac.

* 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 414187704b6173481f992ad96bb1a6df1094bd4d.
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