1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-06 19:11:45 +00:00

4034 Commits

Author SHA1 Message Date
M. Efe Çetin
08d9fda631
enhancement: use msgp for flash message encoding/decoding (#3099)
* enhancement: use msgp for flash message encoding/decoding

* add msgp tests

* improve test coverage

* improve test coverage

* fix linter

* update makefile

* extend go generation process

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2024-08-29 16:45:16 +02:00
René
0fbb447679 Merge remote-tracking branch 'origin/main' 2024-08-28 09:04:44 +02:00
René
59b290db76 update template.md guide 2024-08-28 09:04:37 +02:00
耗子
062ac3bf7b
🩹 Fix: error check in Form binder (#3110)
fix: error check
2024-08-26 08:29:13 +02:00
RW
260c5e5406
Update faq.md 2024-08-22 08:23:03 +02:00
Juan Calderon-Perez
25e399213c
chore: Add support for go1.23 and golangci-lint v1.60.1 (#3101)
* Bump min go to 1.22, bump golangci-lint to v1.60.1, regenerate all msgp

* Fix golanci-lint issues

* Fix golanci-lint issues
2024-08-14 09:14:04 +02:00
Muhamad Surya Iksanudin
e43763311d
v3: Consolidate Logic of Handling the Request Body (#3093)
reduce redundant call
2024-07-27 07:42:54 +02:00
Juan Calderon-Perez
99173cc09f
v3: Add Benchmarks for Rewrite Middleware (#3092)
Add Benchmarks for Rewrite Middleware
2024-07-26 16:55:00 +02:00
Juan Calderon-Perez
0592e01382
v3: Improve Performance of c.Body() by 125% (#3090)
* Improve performance of Body()

* Add unit-test and benchmark for BodyRaw() with Immutable
2024-07-25 08:58:40 +02:00
RW
fadedcb5be
Use utils Trim functions instead of the strings/bytes functions (#3087)
* Use utils Trim functions instead of the strings/bytes functions

* rename Test and Benchmark functions with same name
2024-07-24 16:25:35 +02:00
dependabot[bot]
e2cd1000ea
build(deps): bump actions/checkout from 3 to 4 (#3083)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-24 08:09:58 +02:00
Lucas Lemos
011c8f8007
feat: Add Max Func to Limiter Middleware (#3070)
* feat: add max calculator to limiter middleware

* docs: update docs including the new parameter

* refactor: add new line before go code in docs

* fix: use crypto/rand instead of math/rand on tests

* test: add new test with zero set as limit

* fix: repeated tests failing when generating random limits

* fix: wrong type of MaxCalculator in docs

* feat: include max calculator in limiter_sliding

* refactor: rename MaxCalculator to MaxFunc

* docs: update docs with MaxFunc parameter

* tests: rename tests and add test for limiter sliding
2024-07-23 23:00:37 +02:00
Juan Calderon-Perez
486304d050
v3: Improve performance of helper functions (#3086)
* Improve performance of helper functions

* Fix issue with PR comments from forks
2024-07-23 21:32:22 +02:00
Juan Calderon-Perez
8c3f81e2b7
v3: Use Named Fields Instead of Positional and Align Structures to Reduce Memory Usage (#3079)
* Use composites for internal structures. Fix alignment of structures across Fiber

* Update struct alignment in test files

* Enable alignment check with govet

* Fix ctx autoformat unit-test

* Revert app Config struct. Add betteralign to Makefile

* Disable comment on alert since it wont work for forks

* Update benchmark.yml

* Update benchmark.yml

* Remove warning from using positional fields

* Update router.go
2024-07-23 08:37:45 +02:00
Bruno
f413bfef99
🐛 [Bug]: cache middleware: runtime error: index out of range [0] with length 0 (#3075)
Resolves #3072

Signed-off-by: brunodmartins <bdm2943@icloud.com>
2024-07-23 08:36:41 +02:00
Juan Calderon-Perez
a57b3c00c4
🐛 bug: Use Content-Length for bytesReceived and bytesSent tags in Logger Middleware (#3066)
* logger: Use Content-Length header for BytesReceived and BytesSent tags

* Use strconv.AppendInt instead of fasthttp.AppendUint
2024-07-23 08:35:50 +02:00
RW
ef073601e3
Update benchmark.yml
We should only fail during a PR, not during a merge
2024-07-22 14:36:21 +02:00
René
8e1470fa4a add manual dependabot trigger workflow 2024-07-22 12:05:10 +02:00
René
22e11558e9 Merge remote-tracking branch 'origin/main' 2024-07-22 12:03:31 +02:00
René
ac2ddcf847 add manual dependabot trigger workflow 2024-07-22 12:03:24 +02:00
Juan Calderon-Perez
9c0cb9de13
v3: Refactor Benchmark Results Workflow (#3082)
* Refactor benchmarks workflow

* Use full semver tag

* Add fetch depth
2024-07-22 08:59:38 +02:00
Jason McNeil
0de6a2f394
test(ctx_test): Fix race condition (#3081)
* test(ctx_test): Fix race condition

* chore: Release ctx resource after sending file

* refactor: sendFileBodyReader function

Refactor the `sendFileBodyReader` function to remove the unnecessary `app` parameter. This simplifies the function signature and improves code readability.
2024-07-22 08:50:44 +02:00
Lucas Lemos
9ea76518cc
feat: Add support for RebuildTree (#3074)
* feat: add rebuild tree method

* docs: add newline at the end of app.md

* docs: add an example of dynamic defined routes

* docs: remove tabs from example code on app.md

* Update docs/api/app.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update app.md

* docs: add RebuildTree to what's new documentation

* fix: markdown errors in documentation

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* refactor: add mutex lock to the addRoute function

* refactor: remove mutex lock from addRoute

* refactor: fix mutex deadlock in addRoute

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-07-18 22:08:33 +02:00
kirankumar-grootan
4f1dc49894
feat: Add Startup Probe to Healthcheck Middleware (#3069)
* added startup default probe endpoint

* added test case

* updated docs

* updated test order

* added test case

* fixed go fmt and md lint

* fixed go fmt and md lint

* updated doc as per coderabbitai suggestions

* changed healhtcheck route register to use default const instead of string for test cases

* updated whats new with healthcheck content

* updated whats new doc with coderabbitai sugg

* updated migration guide
2024-07-18 13:54:44 +02:00
Juan Calderon-Perez
091a59472c
v3: Improve performance of Adaptor Middleware (#3078)
* Improve performance of adaptor middleware by over 50%

* Update whats_new documentation

* Remove fasthttp.Request pool

* Update whats_new.md
2024-07-18 13:41:56 +02:00
René
58d07f091d v3: Add support for consistent documentation using markdownlint (#3064) 2024-07-11 16:16:12 +02:00
Juan Calderon-Perez
9463a8f626
v3: Add support for consistent documentation using markdownlint (#3064)
* Add support for consistent documentation using markdownlint

* Only run workflow during changes to markdown files

* Fix more inconsistencies

* Fixes to markdown under .github/

* More fixes

* Apply suggestions from code review

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Fix typo in limiter docs

* Add missing space before code-block

* Add check for dead-links

* Add write-good

* Remove legacy README files

* Fix glob for skipping .md files

* Use paths-ignore instead

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-07-11 15:21:56 +02:00
Juan Calderon-Perez
c579a1a0b3
v3: Improve and simplify logic of ctx.Next() (#3063)
* Simplify Next() handler in Ctx

* Add comments
2024-07-05 16:31:50 +02:00
dependabot[bot]
dfdf9647e1
build(deps): bump github.com/gofiber/utils/v2 from 2.0.0-beta.4 to 2.0.0-beta.5 (#3062)
build(deps): bump github.com/gofiber/utils/v2

Bumps [github.com/gofiber/utils/v2](https://github.com/gofiber/utils) from 2.0.0-beta.4 to 2.0.0-beta.5.
- [Release notes](https://github.com/gofiber/utils/releases)
- [Commits](https://github.com/gofiber/utils/compare/v2.0.0-beta.4...v2.0.0-beta.5)

---
updated-dependencies:
- dependency-name: github.com/gofiber/utils/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-05 15:24:36 +02:00
M. Efe Çetin
4e5a501a47
🐛 bug: fasthttp errors cause panic when Params is used (#3055)
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-07-05 09:18:34 +02:00
Juan Calderon-Perez
d17eb99377
v3: Enforce key length for EncryptCookie middleware default functions (#3056)
* Support for key length, Add benchmarks for EncryptCookie middleware

* Format tests

* Add tests for panics and key check in Encryptor and Decryptor functions

* Add tests for base64 decoding errors

* Update docs/middleware/encryptcookie.md

Co-authored-by: Jason McNeil <sixcolors@mac.com>

* Update middleware/encryptcookie/utils.go

Co-authored-by: Jason McNeil <sixcolors@mac.com>

* Add suggestions from code review

---------

Co-authored-by: Jason McNeil <sixcolors@mac.com>
2024-07-05 09:04:57 +02:00
Juan Calderon-Perez
55138fa506
v3: Update benchmarks for Logger Middleware (#3061)
Add regular and parallel benchmarks for Logger middleware
2024-07-05 08:57:09 +02:00
Juan Calderon-Perez
04528f7d81
v3: Updates to fiberlog benchmarks and documentation (#3059)
* Add missing benchmarks for fiberlog. Rewrite docs

* Update log.md
2024-07-05 08:53:36 +02:00
René
6108475ccb reduce time for longRun test workflow 2024-07-01 15:30:14 +02:00
René
a3768a2598 reduce time for longRun test workflow 2024-07-01 15:26:46 +02:00
René
1e84c183b3 do not create a new version in docs 2024-07-01 14:49:39 +02:00
RW
49ba8dfbaf
Update release.yml v3.0.0-beta.3 2024-06-30 22:08:19 +02:00
M. Efe Çetin
56d60a084e
v3 (feature): add CHIPS support to Cookie (#3047)
*  v3 (feature): add CHIPS support to Cookie

* update docs

* Update docs/whats_new.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update docs/api/ctx.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-06-30 21:38:46 +02:00
Juan Calderon-Perez
a18e8a8967
feat: Add support for longtests during CI (#3054)
* Add support for longtests during CI

* Reduce count from 25 to 15
2024-06-30 21:34:14 +02:00
Jason McNeil
0400af6e47
fix(middleware/session): fix data-race with sync.Pool (#3051)
* feat: Add session mutex lock for thread safety

* chore: Refactor releaseSession mutex

* docs: Improve session.Save() function

The changes include updating the comments to provide clearer explanations of the function's behavior.
2024-06-30 21:18:11 +02:00
M. Efe Çetin
21ede5954c
v3 (feature): add configuration support to c.SendFile() (#3017)
*  v3 (feature): add configuration support to c.SendFile()

* update

* cover more edge-cases

* optimize

* update compression, add mutex for sendfile slice

* fix data races

* add benchmark

* update docs

* update docs

* update

* update tests

* fix linter

* update

* update tests

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-06-30 21:15:22 +02:00
Jason McNeil
83731cef85
fix(middleware/session): mutex for thread safety (#3049)
* fix(middleware/session): mutex for thread safety

* chore: Remove extra release and acquire ctx calls in session_test.go

* feat: Remove unnecessary session mutex lock in decodeSessionData function
2024-06-29 21:47:09 +02:00
RW
dbba6cfa69
fixes #3038 "v3 Flash Message with redirect is not working" (#3046)
* fixes #3038
🐞 [Bug]: v3 Flash Message with redirect is not working #3038

* fixes #3038
🐞 [Bug]: v3 Flash Message with redirect is not working #3038
2024-06-28 15:51:26 +02:00
Dave
2db1858513
🔥 Feature: Add support for custom KeyLookup functions in the Keyauth middleware (#3028)
* port over FallbackKeyLookups from v2 middleware to v3

Signed-off-by: Dave Lee <dave@gray101.com>

* bot pointed out that I missed the format variable

Signed-off-by: Dave Lee <dave@gray101.com>

* fix lint and gofumpt issues

Signed-off-by: Dave Lee <dave@gray101.com>

* major revision: instead of FallbackKeyLookups, expose CustomKeyLookup as function, with utility functions to make creating these easy

Signed-off-by: Dave Lee <dave@gray101.com>

* add more tests to boost coverage

Signed-off-by: Dave Lee <dave@gray101.com>

* teardown code and cleanup

Signed-off-by: Dave Lee <dave@gray101.com>

* test fixes

Signed-off-by: Dave Lee <dave@gray101.com>

* slight boost to test coverage

Signed-off-by: Dave Lee <dave@gray101.com>

* docs: fix md table alignment

* fix comments - change some names, expose functions, improve docs

Signed-off-by: Dave Lee <dave@gray101.com>

* missed one old name

Signed-off-by: Dave Lee <dave@gray101.com>

* fix some suggestions from the bot - error messages, test coverage, mark purely defensive code

Signed-off-by: Dave Lee <dave@gray101.com>

---------

Signed-off-by: Dave Lee <dave@gray101.com>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Jason McNeil <sixcolors@mac.com>
Co-authored-by: RW <rene@gofiber.io>
2024-06-27 20:30:47 +02:00
Can Celik
c9b7b1aefb
🔥 Add Cache Invalidation Option to Cache Middleware (#3036)
* Add an option to invalidate cache

* Add a summary about the cache middleware update

* Rename the option to make it clearer

* Rename hard tab

* Fix markdown formatting

* Revert unnecessary change

* Clarify the description of cache invalidator

* Add empty line

---------

Co-authored-by: RW <rene@gofiber.io>
2024-06-26 16:02:48 +02:00
Juan Calderon-Perez
b9936a339d
🔥 Feature: Add support for zstd compression (#3041)
* Add support for zstd compression

* Update whats_new.md

* Add benchmarks for Compress middleware

---------

Co-authored-by: RW <rene@gofiber.io>
2024-06-26 16:00:38 +02:00
Jason McNeil
dd2625661d
test(middleware/session): Remove extra release and acquire ctx calls in session_test.go (#3044) 2024-06-26 15:30:31 +02:00
René
7a2e99bc8c prepare release v3.0.0-beta.3 2024-06-26 12:17:58 +02:00
Jason McNeil
b53802a5cb
Merge pull request from GHSA-98j2-3j3p-fw2v
* fix: token injection vulnerability GHSA-98j2-3j3p-fw2v

- Ensure session IDs are securely generated server-side.
- Add validation to prevent user-supplied session IDs.
- Update tests to verify correct session token use.

This update addresses the critical session middleware vulnerability identified in versions 2 and above of GoFiber.

* chore: Remove unused code and dependencies in session store

* test(middleware/csrf): Save session after generating new session ID

This commit saves the session after generating a new session ID to ensure that the updated session ID is persisted. This change is necessary to address a critical session middleware vulnerability identified in versions 2 and above of GoFiber.

* chore: Save session ID in context for middleware chain

The code changes add functionality to save the newly generated session ID in the context, allowing it to be accessible to subsequent middlewares in the chain. This improvement ensures that the session ID is available for use throughout the middleware stack.

* refactor(session.go): general clean-up

* chore: Revert session freshness behavior

The code changes in `session_test.go` fix the session freshness check by updating the assertions for `sess.Fresh()` and `sess.ID()`. The previous assertions were incorrect and have been corrected to ensure the session ID remains the same and the session is not fresh.

* chore: Update session.Get method signature to use fiber.Ctx instead of *fiber.Ctx
2024-06-26 09:17:41 +02:00
dependabot[bot]
ba6ea675ba
build(deps): bump github.com/valyala/fasthttp from 1.54.0 to 1.55.0 (#3037)
Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.54.0 to 1.55.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/1.54.0...v1.55.0)

---
updated-dependencies:
- dependency-name: github.com/valyala/fasthttp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-20 15:14:56 +02:00