Commit Graph

4127 Commits (main)

Author SHA1 Message Date
Karen 2c7bdb9fd1
🩹 fix: Close File After SaveFileToStorage (#3197)
* fix: close file after opening in SaveFileToStorage to prevent resource leaks

* ♻️ refactor: simplify file close logic

* Update ctx.go

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-11-12 02:47:22 +01:00
Juan Calderon-Perez dcdd2eb2c6
Bump golangci-lint to v1.62.0 (#3196) 2024-11-11 10:37:27 +01:00
Juan Calderon-Perez 7126e484c9
Merge pull request #3183 from gofiber/dependabot/go_modules/github.com/valyala/fasthttp-1.57.0
build(deps): bump github.com/valyala/fasthttp from 1.56.0 to 1.57.0
2024-11-06 08:57:43 -05:00
dependabot[bot] 87faed717f
build(deps): bump github.com/valyala/fasthttp from 1.56.0 to 1.57.0
Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.56.0 to 1.57.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.56.0...v1.57.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>
2024-11-01 12:58:50 +00:00
dependabot[bot] 9eee2923a5
build(deps): bump github.com/tinylib/msgp from 1.2.3 to 1.2.4 (#3185)
Bumps [github.com/tinylib/msgp](https://github.com/tinylib/msgp) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/tinylib/msgp/releases)
- [Commits](https://github.com/tinylib/msgp/compare/v1.2.3...v1.2.4)

---
updated-dependencies:
- dependency-name: github.com/tinylib/msgp
  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-11-01 13:57:47 +01:00
dependabot[bot] da605b44a7
build(deps): bump github.com/tinylib/msgp from 1.2.1 to 1.2.3 (#3182)
Bumps [github.com/tinylib/msgp](https://github.com/tinylib/msgp) from 1.2.1 to 1.2.3.
- [Release notes](https://github.com/tinylib/msgp/releases)
- [Commits](https://github.com/tinylib/msgp/compare/v1.2.1...v1.2.3)

---
updated-dependencies:
- dependency-name: github.com/tinylib/msgp
  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-10-28 07:48:25 -04:00
xEricL 579d9a3f3d
📚 Doc: Clarify SendFile Docs (#3172)
* 📚 Doc: Clarify SendFile ContentType header set by file format

* 📚 Doc: Make SendFile default value formatting consistent

* 📚 Doc: Add missing `fiber.` in SendFile usage docs

* 📚 Doc: Hyphenate 'case-sensitive'

* 📚 Doc: Clarify `SendFile` behavior for missing/invalid file extensions

* 🚨 Test: Validate `SendFile` Content-Type header

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-10-28 08:11:24 +01:00
Juan Calderon-Perez 9a727043e6
Merge pull request #3174 from gofiber/dependabot/go_modules/github.com/gofiber/utils/v2-2.0.0-beta.7
build(deps): bump github.com/gofiber/utils/v2 from 2.0.0-beta.6 to 2.0.0-beta.7
2024-10-25 23:55:21 -04:00
Juan Calderon-Perez 5d811d8505
Merge pull request #3177 from gofiber/dependabot/github_actions/benchmark-action/github-action-benchmark-1.20.4
build(deps): bump benchmark-action/github-action-benchmark from 1.20.3 to 1.20.4
2024-10-25 23:54:58 -04:00
Juan Calderon-Perez 454c166689
Merge pull request #3181 from alequilesl/patch-1
Doc: balance brakets
2024-10-25 23:53:52 -04:00
alequilesl 3367ecfa5b
balance brakets 2024-10-25 22:28:07 -04:00
Jason McNeil e3232c1505
feat!(middleware/session): re-write session middleware with handler (#3016)
* feat!(middleware/session): re-write session middleware with handler

* test(middleware/session): refactor to IdleTimeout

* fix: lint errors

* test: Save session after setting or deleting raw data in CSRF middleware

* Update middleware/session/middleware.go

Co-authored-by: Renan Bastos <renanbastos.tec@gmail.com>

* fix: mutex and globals order

* feat: Re-Add read lock to session Get method

* feat: Migrate New() to return middleware

* chore: Refactor session middleware to improve session handling

* chore: Private get on store

* chore: Update session middleware to use saveSession instead of save

* chore: Update session middleware to use getSession instead of get

* chore: Remove unused error handler in session middleware config

* chore: Update session middleware to use NewWithStore in CSRF tests

* test: add test

* fix: destroyed session and GHSA-98j2-3j3p-fw2v

* chore: Refactor session_test.go to use newStore() instead of New()

* feat: Improve session middleware test coverage and error handling

This commit improves the session middleware test coverage by adding assertions for the presence of the Set-Cookie header and the token value. It also enhances error handling by checking for the expected number of parts in the Set-Cookie header.

* chore: fix lint issues

* chore: Fix session middleware locking issue and improve error handling

* test: improve middleware test coverage and error handling

* test: Add idle timeout test case to session middleware test

* feat: add GetSession(id string) (*Session, error)

* chore: lint

* docs: Update session middleware docs

* docs: Security Note to examples

* docs: Add recommendation for CSRF protection in session middleware

* chore: markdown lint

* docs: Update session middleware docs

* docs: makrdown lint

* test(middleware/session): Add unit tests for session config.go

* test(middleware/session): Add unit tests for store.go

* test(middleware/session): Add data.go unit tests

* refactor(middleware/session): session tests and add session release test

- Refactor session tests to improve readability and maintainability.
- Add a new test case to ensure proper session release functionality.
- Update session.md

* refactor: session data locking in middleware/session/data.go

* refactor(middleware/session): Add unit test for session middleware store

* test: fix session_test.go and store_test.go unit tests

* refactor(docs): Update session.md with v3 changes to Expiration

* refactor(middleware/session): Improve data pool handling and locking

* chore(middleware/session): TODO for Expiration field in session config

* refactor(middleware/session): Improve session data pool handling and locking

* refactor(middleware/session): Improve session data pool handling and locking

* test(middleware/csrf): add session middleware coverage

* chroe(middleware/session): TODO for unregistered session middleware

* refactor(middleware/session): Update session middleware for v3 changes

* refactor(middleware/session): Update session middleware for v3 changes

* refactor(middleware/session): Update session middleware idle timeout

- Update the default idle timeout for session middleware from 24 hours to 30 minutes.
- Add a note in the session middleware documentation about the importance of the middleware order.

* docws(middleware/session): Add note about IdleTimeout requiring save using legacy approach

* refactor(middleware/session): Update session middleware idle timeout

Update the idle timeout for the session middleware to 30 minutes. This ensures that the session expires after a period of inactivity. The previous value was 24 hours, which is too long for most use cases. This change improves the security and efficiency of the session management.

* docs(middleware/session): Update session middleware idle timeout and configuration

* test(middleware/session): Fix tests for updated panics

* refactor(middleware/session): Update session middleware initialization and saving

* refactor(middleware/session): Remove unnecessary comment about negative IdleTimeout value

* refactor(middleware/session): Update session middleware make NewStore public

* refactor(middleware/session): Update session middleware Set, Get, and Delete methods

Refactor the Set, Get, and Delete methods in the session middleware to use more descriptive parameter names. Instead of using "middlewareContextKey", the methods now use "key" to represent the key of the session value. This improves the readability and clarity of the code.

* feat(middleware/session): AbsoluteTimeout and key any

* fix(middleware/session): locking issues and lint errors

* chore(middleware/session): Regenerate code in data_msgp.go

* refactor(middleware/session): rename GetSessionByID to GetByID

This commit also includes changes to the session_test.go and store_test.go files to add test cases for the new GetByID method.

* docs(middleware/session): AbsoluteTimeout

* refactor(middleware/csrf): Rename Expiration to IdleTimeout

* docs(whats-new): CSRF Rename Expiration to IdleTimeout and remove SessionKey field

* refactor(middleware/session): Rename expirationKeyType to absExpirationKeyType and update related functions

* refactor(middleware/session): rename Test_Session_Save_Absolute to Test_Session_Save_AbsoluteTimeout

* chore(middleware/session): update as per PR comments

* docs(middlware/session): fix indent lint

* fix(middleware/session): Address EfeCtn Comments

* refactor(middleware/session): Move bytesBuffer to it's own pool

* test(middleware/session): add decodeSessionData error coverage

* refactor(middleware/session): Update absolute timeout handling

- Update absolute timeout handling in getSession function
- Set absolute expiration time in getSession function
- Delete expired session in GetByID function

* refactor(session/middleware): fix *Session nil ctx when using Store.GetByID

* refactor(middleware/session): Remove unnecessary line in session_test.go

* fix(middleware/session): *Session lifecycle issues

* docs(middleware/session): Update GetByID method documentation

* docs(middleware/session): Update GetByID method documentation

* docs(middleware/session): markdown lint

* refactor(middleware/session): Simplify error handling in DefaultErrorHandler

* fix( middleware/session/config.go

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

* add ctx releases for the test cases

---------

Co-authored-by: Renan Bastos <renanbastos.tec@gmail.com>
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: René <rene@gofiber.io>
2024-10-25 08:36:30 +02:00
dependabot[bot] 941ab11789
build(deps): bump benchmark-action/github-action-benchmark
Bumps [benchmark-action/github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) from 1.20.3 to 1.20.4.
- [Release notes](https://github.com/benchmark-action/github-action-benchmark/releases)
- [Changelog](https://github.com/benchmark-action/github-action-benchmark/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benchmark-action/github-action-benchmark/compare/v1.20.3...v1.20.4)

---
updated-dependencies:
- dependency-name: benchmark-action/github-action-benchmark
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-23 12:29:25 +00:00
dependabot[bot] 54714172d2
build(deps): bump github.com/gofiber/utils/v2
Bumps [github.com/gofiber/utils/v2](https://github.com/gofiber/utils) from 2.0.0-beta.6 to 2.0.0-beta.7.
- [Release notes](https://github.com/gofiber/utils/releases)
- [Commits](https://github.com/gofiber/utils/compare/v2.0.0-beta.6...v2.0.0-beta.7)

---
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>
2024-10-21 12:35:18 +00:00
xEricL 298975a982
🔥Feature: Add support for TrustProxy (#3170)
* 🔥 Feature: Add `TrustProxyConfig` and rename `EnableTrustedProxyCheck` to `TrustProxy`

* 📚 Doc: Document TrustProxyConfig usage and migration

* 🚨 Test: Validate and Benchmark use of TrustProxyConfig

* 🩹 Fix: typo in RequestMethods docstring

* 🩹 Fix: typos in TrustProxy docstring and JSON tags

* 🩹 Fix: Move `TrustProxyConfig.Loopback` to beginning of if-statement

* 🎨 Style: Cleanup spacing for Test_Ctx_IsProxyTrusted

* 📚 Doc: Replace `whitelist` with `allowlist` for clarity

* 📚 Doc: Improve `TrustProxy` doc wording

* 🩹 Fix: validate IP addresses in `App.handleTrustedProxy`

* 🩹 Fix: grammatical errors and capitalize "TLS"
2024-10-17 08:29:03 +02:00
Juan Calderon-Perez 7b3a36f22f
Revert "Update README.md (#3165)" (#3166)
This reverts commit 9dd3d94ff2.
2024-10-13 12:04:02 +03:00
Maria Niranjan 9dd3d94ff2
Update README.md (#3165)
Missing a pointer reference when passing the context object in the route handler function. In Fiber, the context (c) is a pointer, so it should be *fiber.Ctx instead of fiber.Ctx.
2024-10-12 17:05:23 +03:00
Juan Calderon-Perez 48e82e753c
Merge pull request #3164 from SantiagoBobrik/fix/hooks-docs
📚 Doc: typo in hooks documentation
2024-10-11 22:16:53 -04:00
Santiago Diaz 72e97c555d
fix: typo in hooks documentation 2024-10-11 22:56:05 -03:00
Aaron Zingerle 079d301c50
🩹 Fix: Middleware/CORS Remove Scheme Restriction (#3163)
🩹 Fix: middleware/cors remove scheme restriction (gofiber#3160)

Co-authored-by: Aaron Zingerle <aaron.zingerle@vipaso.io>
Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
2024-10-11 15:02:36 +03:00
M. Efe Çetin 3fc1b29748
chore: replace vendored gorilla/schema package (#3152) 2024-10-11 14:52:09 +03:00
René c86c3c0a30 Update documentation for monitor middleware migration 2024-10-09 09:41:15 +02:00
dependabot[bot] 0b6a26fb92
build(deps): bump codecov/codecov-action from 4.5.0 to 4.6.0 (#3154)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.5.0 to 4.6.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4.5.0...v4.6.0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  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>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-10-08 08:19:24 -04:00
Muhamad Surya Iksanudin 2eba89aadc
docs: Fix typo on comment (#3158)
fix typo
2024-10-07 22:23:23 +02:00
Sigmund Xia 夏天睿 85a5fb8cf2
🩹Fix: Adaptor middleware duplicates cookies (#3151)
* 🩹Fix: Adaptor middleware duplicates cookies

* 🩹Fix: add extra cases for Test_HTTPMiddlewareWithCookies

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-10-03 16:19:27 +02:00
miyamo2 44cd700ad5
🩹 Fix: behavior of `DefaultCtx.Fresh` when 'Last-Modified' and 'If-Modified-Since' are equal (#3150)
* fix(ctx): 'if-modified-since' and 'last-modified' are equal, `DefaultCtx.Fresh` now returns true

* accurate benchmark measurements
2024-09-26 08:42:35 +02:00
RW 0c1f5ffde8
build(deps): bump github.com/tinylib/msgp from 1.1.8 to 1.2.1 (#3147) 2024-09-25 17:14:32 +02:00
dependabot[bot] 014f20efd5
build(deps): bump github.com/valyala/fasthttp from 1.55.0 to 1.56.0 (#3146)
Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.55.0 to 1.56.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.55.0...v1.56.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-09-25 16:09:43 +02:00
miyamo2 0caa103a43
chore(middleware/cache): fix typo (#3145) 2024-09-25 08:44:04 +02:00
Oktay Özkan 1169e9ac99
📚 Doc: removed zero width white space from logger docs (#3144)
removed zero width white space from logger docs
2024-09-24 09:40:02 +02:00
nexovec 53199f67b8
Replaced link to russian mozilla docs (#3142) 2024-09-23 18:08:24 +02:00
Juan Calderon-Perez f8c514cb25
v3: Optimize IsFromLocal() performance (#3140)
Optimize IsFromLocal()
2024-09-23 15:16:52 +02:00
Juan Calderon-Perez fbc24e83d6
v3: Fix issue with default logger when creating RequestCtx (#3134)
Use Noop Logger when creating RequestCtx
2024-09-15 19:45:44 +02:00
Juan Calderon-Perez 0ef8d716ee
Bump golangci-lint to v1.61.0 (#3135)
* Bump golangci-lint to v1.61.0

* Fix golangci warnings
2024-09-15 19:28:22 +02:00
dependabot[bot] 37f1a65c4c
build(deps): bump DavidAnson/markdownlint-cli2-action from 16 to 17 (#3128)
Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 16 to 17.
- [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases)
- [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v16...v17)

---
updated-dependencies:
- dependency-name: DavidAnson/markdownlint-cli2-action
  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>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-09-15 19:05:16 +02:00
Juan Calderon-Perez 5c1a0ce9c7
Merge pull request #3133 from yinheli/bugfix/typos
📚 Doc: Fix typos in client hooks documentation
2024-09-14 11:40:53 -04:00
yinheli 311dc3fb92
📚 Doc: Fix typos in client hooks documentation 2024-09-14 23:36:19 +08:00
Glen Sargent 96891c93d3
📚 Doc: Update recover docs to not use reserved keyword (#3129)
update(docs): avoid using reserved keyword
2024-09-11 20:42:53 +02:00
Vaibhav Gupta 62f66e5968
🩹 Fix (v3): handle un-matched open brackets in the query params (#3126)
* Add logic for handling unmatched square brackets in query params

* Add UTs

* Fix lint: fieldalignment error

* Add UTs
2024-09-09 08:11:47 +02:00
Juan Calderon-Perez f668537c02
chore: Bump golangci-lint to v1.60.3 (#3119)
Bump golangci-lint to v1.60.3
2024-09-02 15:38:59 +02:00
AuroraTea 4acdc602ce
📚 Doc: Update example in middleware/cors to v3 (#3116)
* docs: update examples to v3 in middleware/cors

* Update docs/middleware/cors.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-08-31 18:38:43 +03:00
René 9541a88f2a fix template markdown 2024-08-30 17:18:55 +02:00
M. Efe Çetin 4b1ee0b48d
client: fix SetProxyURL functionality (#3109)
* client: fix SetProxyURL functionality

* Update client_test.go

* fix lint error (gofumpt)

---------

Co-authored-by: RW <rene@gofiber.io>
2024-08-29 16:57:01 +02:00
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