Commit Graph

4044 Commits (improve_timeout_mw_structure)

Author SHA1 Message Date
Juan Calderon-Perez 376d0d9204
Merge branch 'main' into improve_timeout_mw_structure 2025-01-07 18:41:58 -05:00
René 1077ab44aa refactor(timeout): add more test cases and handle zero duration case 2025-01-07 20:21:32 +01:00
René 649488dce1 refactor(timeout): add more test cases and handle zero duration case 2025-01-07 20:16:57 +01:00
René 803c5b9ab7 refactor(timeout): add more test cases and handle zero duration case 2025-01-07 20:14:28 +01:00
René 32f1e68a94 refactor(timeout): remove goroutine-based logic and improve documentation
- Switch to a synchronous approach to avoid data races with fasthttp context
- Enhance error handling for deadline and custom errors
- Update comments for clarity and maintainability
2025-01-07 20:00:30 +01:00
René 88458c522f feat(timeout): unify and enhance timeout middleware
- Combine classic context-based timeout with a Goroutine + channel approach
- Support custom error list without additional parameters
- Return fiber.ErrRequestTimeout for timeouts or listed errors
2025-01-07 19:44:33 +01:00
René f5598934cd feat(timeout): unify and enhance timeout middleware
- Combine classic context-based timeout with a Goroutine + channel approach
- Support custom error list without additional parameters
- Return fiber.ErrRequestTimeout for timeouts or listed errors
2025-01-07 19:42:48 +01:00
dependabot[bot] 86d72bbba8
build(deps): bump golang.org/x/crypto from 0.31.0 to 0.32.0 (#3274)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.31.0 to 0.32.0.
- [Commits](https://github.com/golang/crypto/compare/v0.31.0...v0.32.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  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>
2025-01-07 19:20:53 +01:00
René a95ffd8eff fix doc examples for generic function 2025-01-06 08:36:06 +01:00
Giovanni Rivera ac82b0c413
📚 Doc: Fix static middleware CacheDuration data type typo (#3273) 2025-01-03 10:36:58 +03:00
M. Efe Çetin 5355869d4d
🐛 bug: make Render bind parameter type any again (#3270)
* 🐛 bug: make Render bind parameter type any again

* update  docs
2025-01-02 08:42:25 +01:00
René d5771a34df prepare release 3.0.0-beta.4 2024-12-31 17:00:40 +01:00
M. Efe Çetin ef04a8a99e
🐛 bug: Fix square bracket notation in Multipart FormData (#3235)
* 🐛 bug: add square bracket notation support to BindMultipart

* Fix golangci-lint issues

* Fixing undef variable

* Fix more lint issues

* test

* update1

* improve coverage

* fix linter

* reduce code duplication

* reduce code duplications in bindMultipart

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2024-12-31 16:34:28 +01:00
AuroraTea d0e767fc47
📚 Doc: Optimize the menu item text (#3267) 2024-12-31 15:58:07 +01:00
dependabot[bot] 26e30c0672
build(deps): bump DavidAnson/markdownlint-cli2-action from 18 to 19 (#3266)
Bumps [DavidAnson/markdownlint-cli2-action](https://github.com/davidanson/markdownlint-cli2-action) from 18 to 19.
- [Release notes](https://github.com/davidanson/markdownlint-cli2-action/releases)
- [Commits](https://github.com/davidanson/markdownlint-cli2-action/compare/v18...v19)

---
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>
2024-12-30 14:18:54 +01:00
Juan Calderon-Perez 845a7f8b8e
🧹 chore: Improve Performance of Fiber Router (#3261)
* Initial improvements

* Update test

* Improve RemoveEscapeChar performance

* Fix lint issues

* Re-add comments

* Add dedicated request handlers

* Fix lint issues

* Add test case for app.All with custom method

* Add test for custom Ctx and Request Methods

* Simplify test logic

* Simplify test
2024-12-29 19:34:34 +01:00
Bulat Bagaviev 775e0a73f3
🩹 Fix: Memory leak removal in the idempotency middleware (#3263)
* 🩹 Fix: Add key removal in MemoryLock

* Fixed concurrent deletion.

* Fix: idempotency middleware's MemoryLock

* Add MemoryLock benchmarks.

* Updated benchmarks: Add returning error handling

* Renamed benchmark: RepeatedKeys

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-12-28 14:29:31 +01:00
M. Efe Çetin 57744ebbe8
🐛 bug: fix EnableSplittingOnParsers is not functional (#3231)
* 🐛 bug: fix EnableSplittingOnParsers is not functional

* remove wrong testcase

* add support for external xml decoders

* improve test coverage

* fix linter

* update

* add reset methods

* improve test coverage

* merge Form and MultipartForm methods

* fix linter

* split reset and putting steps

* fix linter
2024-12-25 12:53:14 +01:00
ACHMAD IRIANTO EKA PUTRA 58677d5c86
feat: Add Drop method to DefaultCtx for silent connection termination (#3257)
* Add Drop method to DefaultCtx and remove redundant checks

Introduced a Drop method in DefaultCtx for closing connections, enabling easier resource management. Removed unnecessary nil-checks for headers in manager_msgp to simplify code logic. Added a unit test to ensure the new Drop method behaves as expected.

* Add `Drop` method to Fiber context API documentation

The `Drop` method allows silently terminating client connections without sending HTTP headers or a response body. This is useful for scenarios like mitigating DDoS attacks or blocking unauthorized access to sensitive endpoints. Example usage and function signature are included in the updated documentation.

* Remove extraneous blank line in documentation.

Eliminated an unnecessary blank line in the API context documentation for improved readability and formatting consistency. No functional changes were made to the content.

* Update API documentation example to return "Hello World!"

Revised the example code in the API documentation to return a generic "Hello World!" string instead of a dynamic response. This improves consistency and simplifies the example for easier understanding.

* Refactor Drop method and extend test coverage.

Simplified the Drop method by inlining the connection close call. Added new test cases to ensure proper handling of no-response scenarios and improved overall test coverage.

* fix golangci-lint issue

* Add test for Ctx.Drop with middleware interaction

This test ensures the correct behavior of the Ctx.Drop method when used with middleware, including response handling and error scenarios. It verifies that the middleware and handler properly handle the Drop call and its resulting effects.

* Add Drop method to DefaultCtx for closing connections

The Drop method allows closing connections without sending a response, improving control over connection handling. Also updated a test assertion to use StatusOK for improved readability and consistency.

* Refine Drop method comments to clarify error handling.

Explain the rationale for not wrapping errors in the Drop method. Emphasize that the returned error is solely for logging and not for further propagation or processing.

* Update Drop method documentation for clarity

Clarified the `Drop` method's behavior, specifying that it closes the connection without sending headers or a body. Added examples of use cases, such as DDoS mitigation and blocking sensitive endpoints.

* Refactor response header setting in middleware.

Replaced the direct header setting with the `Set` method for consistency and improved clarity. Removed a test case checking for a panic on closed response body as it is no longer applicable.
2024-12-23 08:20:41 +01:00
Juan Calderon-Perez 1c9b6cedce
Merge pull request #3256 from gofiber/dependabot/github_actions/codecov/codecov-action-5.1.2
build(deps): bump codecov/codecov-action from 5.1.1 to 5.1.2
2024-12-19 08:01:36 -05:00
RW 6a5d81d4c9
Update path.go
fix comment spelling
2024-12-19 14:00:17 +01:00
dependabot[bot] 725aa5ac00
build(deps): bump codecov/codecov-action from 5.1.1 to 5.1.2
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.1.1 to 5.1.2.
- [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/v5.1.1...v5.1.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-19 12:33:45 +00:00
Kashiwa 69e5ccdd22
♻️ Refactor: Rename the Method Names of FormData and FormDatas (#3251) (#3255)
♻️ refactor: rename methods
2024-12-19 08:30:13 +01:00
Juan Calderon-Perez c2b557c5ac
🧹 chore: Update documentation for Fiber client (#3249)
* Update client package inline documentation

* Update inline docs

* Update Client Request docs

* Fix formatting issues

* Update docs

* Update docs/client/response.md

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

* Add missing space

* Remove return statement

* Update request.go

* Update docs/client/response.md

* Update docs/client/hooks.md

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2024-12-16 14:25:15 +01:00
Iliya 154c74d578
🔥 feat: Add support for configuring TLS Min Version (#3248)
* Make tls.Config MinVersion configurable

This commit will resolve #3239
For more info: https://github.com/gofiber/fiber/issues/3239

* Add documents about tls minimum version configurable

* Add if statement for don't allow to use TLS1.0 and TLS1.1

* Fix lint issues, add test for panic()

* Update docs

* Add test with valid TLS version

---------

Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
2024-12-16 09:07:41 +01:00
dependabot[bot] 02999352cd
build(deps): bump github.com/valyala/fasthttp from 1.57.0 to 1.58.0 (#3244)
* build(deps): bump github.com/valyala/fasthttp from 1.57.0 to 1.58.0

Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.57.0 to 1.58.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.57.0...v1.58.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>

* Cookies should expire immediately as per RFC6265

---------

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 <jgcalderonperez@protonmail.com>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-12-16 09:03:57 +01:00
Kashiwa 1134e1f408
🩹 fix: make SetValWithStruct set zero values and support more types #3167 (#3227)
* 🩹 fix: make SetValWithStruct set zero values and support more types

* 🚨 test: check zero in int_slice

* fix: SetValWithStruct does not exist in fiber v2

* 🩹fix: restrict supported types in SetValWithStruct

* 🩹fix: golangci-lint

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-12-13 11:14:11 +01:00
Juan Calderon-Perez a63bd340a4
Merge pull request #3247 from gofiber/dependabot/go_modules/golang.org/x/crypto-0.31.0
build(deps): bump golang.org/x/crypto from 0.30.0 to 0.31.0
2024-12-12 07:55:56 -05:00
dependabot[bot] f94ac3c609
build(deps): bump golang.org/x/crypto from 0.30.0 to 0.31.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 12:40:39 +00:00
Juan Calderon-Perez ec485791ca
Merge pull request #3243 from gofiber/dependabot/go_modules/golang.org/x/crypto-0.30.0
build(deps): bump golang.org/x/crypto from 0.28.0 to 0.30.0
2024-12-10 08:59:53 -05:00
dependabot[bot] b513a00f44
build(deps): bump golang.org/x/crypto from 0.28.0 to 0.30.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.28.0 to 0.30.0.
- [Commits](https://github.com/golang/crypto/compare/v0.28.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-10 12:16:06 +00:00
M. Efe Çetin e9849b758d
🔥 feat: Add support for iterator methods to Fiber client (#3228)
* chore: simplify parserRequestBodyFile logic

* client: add support for go1.23 iterators

* Apply suggestions from code review

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

* fix linter

* fix tests

* correct benchmark

* fix linter

* create docs

* update

* rename FormDatas -> AllFormData

* add examples for maps.Collect()

* change request/response markdown examples

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2024-12-10 10:39:23 +01:00
Jinquan Wang 27cfd3c8cd
🔥 feat: Add support for AutoTLS / ACME (#3201)
* feat: add a simple support for app.Listen

* fix: fix the nil access error

* chore: add test case for simple tls

* fix: align the struct

* chore: change the test case

can't passed and not chack the file yet

* fix: use TLS1.2 min

* Fix lint issues

* Fix call to os.MkdirTemp

* Fix test check order

* Update unit-tests for ACME

* Update docs

* Fix identation of whats_new examples

* More updates to docs

* Remove ACME tests. Add check for tlsConfig

* Add ACME section to whats_new docs

* Update docs/whats_new.md

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

* Update fiber.md

* Update whats_new.md

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-12-10 10:12:33 +01:00
dependabot[bot] 70a06c5887
build(deps): bump github.com/tinylib/msgp from 1.2.4 to 1.2.5 (#3240)
Bumps [github.com/tinylib/msgp](https://github.com/tinylib/msgp) from 1.2.4 to 1.2.5.
- [Release notes](https://github.com/tinylib/msgp/releases)
- [Commits](https://github.com/tinylib/msgp/compare/v1.2.4...v1.2.5)

---
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-12-09 16:50:34 +03:00
Juan Calderon-Perez 4347857372
Merge pull request #3234 from gofiber/dependabot/github_actions/codecov/codecov-action-5.1.1
build(deps): bump codecov/codecov-action from 5.0.7 to 5.1.1
2024-12-06 08:58:05 -05:00
dependabot[bot] 1e38dbf345
build(deps): bump codecov/codecov-action from 5.0.7 to 5.1.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.7 to 5.1.1.
- [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/v5.0.7...v5.1.1)

---
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>
2024-12-06 12:12:43 +00:00
Kashiwa 89a0cd3fa5
🔥 feat: Add support for graceful shutdown timeout in ListenConfig (#3220)
* 🔥 feat: Add support for graceful shutdown timeout in Listen

* 📚 doc: update the description of GracefulShutdownTimeout

* ♻️refact: use require.ErrorIs instead of require.Equal

* fix: Target error should be in err chain by using fasthttputil.ErrInmemoryListenerClosed

* ♻️refact: use require.ErrorIs instead of require.Equal

* 📚doc: update the description of GracefulShutdownTimeout

* ♻️refact: rename GracefulShutdownTimeout to ShutdownTimeout

* 🩹fix: set default ShutdownTimeout to 10s

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-12-04 13:55:36 +01:00
René 9a2ceb7220 fix duplicated benchmark name problem 2024-12-01 15:30:45 +01:00
René 689537a0d2 fix duplicated benchmark name problem 2024-12-01 15:14:32 +01:00
M. Efe Çetin 77622700d7
chore: mark go1.23 as minimum go version (#3226) 2024-12-01 14:39:49 +01:00
Hao Chun Chang 67021360e1
🔥 Feature: Add AllLogger to Config (#3153)
* 🔥 Feature: Add SetFlags to Logger Interface

🔥 Feature: Add fiberlog Logger field to config

* 🚨 Test: custom-defined Logger and LoggerFunc

* 📚 Doc: add LoggerFunc and Logger to middleware logger

* 🚨 Test: fine-tune custom Logger and LoggerFunc

* 📚 Doc: add Logger documentation

📚 Doc: add custom Logger example

* 🩹 fix: add default Logger field to default config

* 📚 Doc: remove Logger field in middleware logger

📚 Doc: add example of using fiber logger interface

* 🚨 Test: add tests for using fiber logger interface wrapper

* 📚 Doc: update custom logger example

* Update docs/middleware/logger.md

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

* update

* update logger docs

* update what's new

* replace setflags with getloggerinstance

* fix linter

* update

* Fix markdownlint issues

* apply reviews & improve coverage

* fix linter

* rename controllogger

* Update whats_new.md

expandable example

---------

Co-authored-by: RW <rene@gofiber.io>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Muhammed Efe Cetin <efectn@protonmail.com>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-12-01 13:32:52 +01:00
René f31ec351c7 Update constants.md documentation 2024-12-01 13:17:38 +01:00
RW 60dfd6b313
Update constants.md
fix syntax
2024-12-01 13:04:14 +01:00
Sumit Kumar 26cc477500
🔥 feat: Add support for CBOR encoding (#3173)
* feat(cbor): allow encoding response bodies in cbor

* fix(tests::cbor): encode struct instead of a randomly ordered hashmap

* docs(whats_new): add cbor in context section

* feat(binder): introduce CBOR

* feat(client): allow cbor in fiber client

* chore(tests): add more test

* chore(packages): go mod tidy

* fix(binder): update CBOR name and test

* improve test coverage

* improve test coverage

* update1

* add docs

* doc fixes

* update

* Fix markdown lint

* Add missing entry from binder README

* add/refresh documentation

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
Co-authored-by: RW <rene@gofiber.io>
2024-12-01 11:03:50 +01:00
René 89452fea32 Update whats_new.md documentation 2024-11-29 16:12:15 +01:00
René 86fd29ac27 Update whats_new.md documentation 2024-11-29 16:04:10 +01:00
René 6a36f6d4e6 Update whats_new.md documentation 2024-11-29 15:56:31 +01:00
RW 1bfbb5056c
Update README.md
fix donation image sizes
2024-11-28 09:51:39 +01:00
Giovanni Rivera 31a503f699
🔥 Feature (v3): Add buffered streaming support (#3131)
* 🔥 Feature: Add SendStreamWriter to Ctx

Create a new `*DefaultCtx` method called `SendStreamWriter()`
that maps to fasthttp's `Response.SetBodyStreamWriter()`

* 🚨 Test: Validate regular use of c.SendStreamWriter()

- Adds Test_Ctx_SendStreamWriter to ctx_test.go

* 🚨 Test: (WIP) Validate interrupted use of c.SendStreamWriter()

- Adds Test_Ctx_SendStreamWriter_Interrupted to ctx_test.go
    - (Work-In-Progress) This test verifies that some data is
      still sent before a client disconnects when using the method
      `c.SendStreamWriter()`.

**Note:** Running this test reports a race condition when using
the `-race` flag or running `make test`. The test uses a channel
and mutex to prevent race conditions, but still triggers a warning.

* 📚 Doc: Add `SendStreamWriter` to docs/api/ctx.md

* 🩹 Fix: Remove race condition in Test_Ctx_SendStreamWriter_Interrupted

* 🎨 Styles: Update ctx_test.go to respect golangci-lint

* 📚 Doc: Update /docs/api/ctx.md to show proper `w.Flush()` error handling

* 📚 Doc: Add SendStreamWriter details to docs/whats_new.md

* 🎨 Styles: Update /docs/whats_new.md to respect markdownlint-cli2

* 🩹 Fix: Fix Fprintf syntax error in docs/whats_new.md

---------

Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
2024-11-27 11:11:56 +01:00
Juan Calderon-Perez ff55cfd7c7
Merge pull request #3217 from gofiber/dependabot/go_modules/github.com/stretchr/testify-1.10.0
build(deps): bump github.com/stretchr/testify from 1.9.0 to 1.10.0
2024-11-25 07:51:04 -05:00