4251 Commits

Author SHA1 Message Date
Muhammed Efe Cetin
d5624db3bc
add fallback context for session 2025-07-13 15:12:59 +03:00
Muhammed Efe Cetin
3e850d2f66
update docs 2025-07-13 14:51:43 +03:00
Muhammed Efe Cetin
9c9f77da28
add simple context check to internal storage 2025-07-13 14:49:46 +03:00
RW
1375f46c20
Merge branch 'main' into update-storage 2025-07-10 13:19:29 +02:00
Juan Calderon-Perez
e98e09ed7b
Merge pull request #3568 from gofiber/dependabot/go_modules/github.com/gofiber/utils/v2-2.0.0-beta.10
build(deps): bump github.com/gofiber/utils/v2 from 2.0.0-beta.9 to 2.0.0-beta.10
2025-07-09 09:24:21 -04:00
dependabot[bot]
14b734d7fc
build(deps): bump github.com/gofiber/utils/v2
Bumps [github.com/gofiber/utils/v2](https://github.com/gofiber/utils) from 2.0.0-beta.9 to 2.0.0-beta.10.
- [Release notes](https://github.com/gofiber/utils/releases)
- [Commits](https://github.com/gofiber/utils/compare/v2.0.0-beta.9...v2.0.0-beta.10)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-09 12:59:10 +00:00
René
289f8a54c9 create new file for storage interface (storage_interface.go) 2025-07-07 14:51:54 +02:00
Muhammed Efe Cetin
c2ae40c6b8
fix linter 2025-07-07 14:39:18 +03:00
Muhammed Efe Cetin
2514afd3ce
feat: add context methods to fiber.Storage interface 2025-07-07 14:34:29 +03:00
Juan Calderon-Perez
10e92eb203
🐛 bug: Fix multipart boundary for Client per RFC 2046 (#3563)
🩹 Fix: remove leading dashes from multipart boundary
2025-07-03 18:30:47 +02:00
Kashiwa
01d8543bed
♻️ Refactor: improve iterator performance. (#3562)
* ♻️ Refactor: improve iterator performance.

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3/client
cpu: Apple M4
                        │   old.txt    │           new.txt           │
                        │    sec/op    │   sec/op     vs base        │
_Request_Headers-10       140.15n ± 0%   99.39n ± 1%  -29.08% (n=50)
_Request_Params-10        135.70n ± 0%   41.01n ± 0%  -69.78% (n=50)
_Request_AllFormData-10   135.60n ± 0%   94.67n ± 0%  -30.18% (n=50)
_Headers-10                291.3n ± 0%   156.8n ± 1%  -46.17% (n=50)
geomean                    165.6n        88.20n       -46.73%

                        │   old.txt   │              new.txt               │
                        │    B/op     │    B/op     vs base                │
_Request_Headers-10        200.0 ± 0%   184.0 ± 0%   -8.00% (n=50)
_Request_Params-10        232.00 ± 0%   88.00 ± 0%  -62.07% (n=50)
_Request_AllFormData-10    232.0 ± 0%   184.0 ± 0%  -20.69% (n=50)
_Headers-10                296.0 ± 0%   376.0 ± 0%  +27.03% (p=0.000 n=50)
geomean                    237.6        182.9       -23.00%

                        │  old.txt   │          new.txt           │
                        │ allocs/op  │ allocs/op   vs base        │
_Request_Headers-10       7.000 ± 0%   6.000 ± 0%  -14.29% (n=50)
_Request_Params-10        9.000 ± 0%   4.000 ± 0%  -55.56% (n=50)
_Request_AllFormData-10   9.000 ± 0%   6.000 ± 0%  -33.33% (n=50)
_Headers-10               9.000 ± 0%   6.000 ± 0%  -33.33% (n=50)
geomean                   8.452        5.422       -35.85%
```

* 🩹 Fix: fix wrong logic and revert Headers()
2025-07-02 20:35:03 +02:00
RW
e041d63ce9
🧹 chore: Add iterator helpers for client types (#3560)
* feat: add All iterators for client cookie and path params

* Remove deprecated VisitAll helpers
2025-07-02 13:39:25 +02:00
Juan Calderon-Perez
e9e036716a
🧹 chore: Fix compression benchmarks (#3561)
fix benchmark expectations for compression
2025-07-02 07:48:05 +02:00
RW
dd739687d3
Refactor fasthttp iter calls to range loops (#3559)
refactor: replace fastHTTP iter calls with for loops
2025-07-01 14:14:56 +02:00
dependabot[bot]
eddecf22e4
build(deps): bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0 (#3557)
* build(deps): bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0

Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.62.0 to 1.63.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.62.0...v1.63.0)

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

Signed-off-by: dependabot[bot] <support@github.com>

* Bump github.com/valyala/fasthttp from 1.62.0 to 1.63.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: René <rene@gofiber.io>
2025-07-01 11:06:50 +02:00
Juan Calderon-Perez
4597bc8f81
📒 docs: Add documentation for Stale() (#3555)
* Update docs for Stale()

* Apply suggestions from code review

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-07-01 09:09:30 +02:00
Juan Calderon-Perez
433d570202
📒 docs: Add net/http compatiblity section (#3556)
* General documentation updates

* Update README.md
2025-07-01 09:08:45 +02:00
Juan Calderon-Perez
fd188301e8
🐛 bug: Fix Body() handling of Content-Encoding per RFC 9110 (#3543)
* Adjust Body() decoding loop

* Handle identity and compress encodings

* Adjust Body status handling

* test: cover multi-encoding decode

* Address review feedback
2025-06-30 09:07:06 +02:00
Juan Calderon-Perez
d79fa01f0f
🐛 bug: Fix Content-Disposition header per RFC 6266 (#3551)
* Use raw UTF-8 filenames in Content-Disposition

* Fix lint issues

* Fix issue with new funct

* Improve and fix quoteRawString

* fix issues

* Fix lint issues

* fix golangci-lint

* Update static_test.go

* Update static_test.go
2025-06-30 09:06:11 +02:00
Laptop
cfa5b3a404
🔥 feat: Add UNIX socket support (#3535)
* set unix socket filemode and remove old unix socket before listening

* add UnixSocketFileMode to docs

* create NetworkUnix constant

* Add testing for listening on Unix network

* fix: always remove temporary directory in test

* try fix test on windows

* align ListenConfig struct

* document unix socket support in whats_new.md

* change default UnixSocketFileMode to 0770

* extend unix socket test

* reword about unix sockets support in whats_new.md

* Update docs/whats_new.md

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2025-06-30 09:04:52 +02:00
Juan Calderon-Perez
bdd9e22bd7
🐛 bug: Fix Cache middleware handling of Age (#3547)
* Revert benchmark loop changes

* test: cover Age header parsing

* generate msgp files

* Update cache.go

* Cast result

* Update cache.go
2025-06-30 09:04:35 +02:00
Juan Calderon-Perez
55e7b1eb9c
🐛 bug: Fix Accept-Language matching per RFC 4647 (#3553)
* test: expand Accept-Language coverage

* Refine Accept-Language matching
2025-06-30 08:58:25 +02:00
Juan Calderon-Perez
fc803ec250
🐛 bug: Fix Range() handling of HTTP 416 per RFC 9110 (#3552)
* fix range compliance

* Update ctx.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update ctx.go

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2025-06-30 08:57:53 +02:00
Thai Nguyen Hung
9d683ba421
🐛 fix(docs): incorrect usage of backslash characters in the constraint … (#3549)
fix(docs): incorrect usage of backslash characters in the constraint examples
2025-06-30 08:55:25 +02:00
Juan Calderon-Perez
30bb809255
🐛 bug: Fix Etag validation per RFC 9110 (#3554)
* Add strong ETag comparison helper

* Review fixes

* update normalizeEtag

* cleanup new tests, add more cases.

* lint

* name param

* more fixes

* more fixes

* add missing param

* fix funct name

* string not bytes

* format is correct

* fix lint?

* enable debug output for linter

* Fix linter issue
2025-06-30 08:52:01 +02:00
Juan Calderon-Perez
55818fb5bb
🧹 chore: Improve Accept* compliance with RFC 9110 (#3548)
* fix Accepts header compliance

* Simplify joinHeaderValues using bytes.Join

* Handle errors in unescapeHeaderValue

* test: cover header helpers

* Add paramsMatch escape error test
2025-06-28 21:29:19 +02:00
Juan Calderon-Perez
596c59a018
🧹 chore: Improve Router tests coverage (#3550)
* Integrate router additional tests

* Fix linter issue
2025-06-28 21:28:08 +02:00
Juan Calderon-Perez
43ad9f7928
🐛 bug: Fix Range() parsing of bytes unit (#3541)
refactor(ctx): use utils helpers for Range
2025-06-26 14:13:40 +02:00
Juan Calderon-Perez
8e2ab968db
🧹 chore: Improve Cookie() validation (#3546)
* validate cookies with net/http

* refactor: sanitize cookie via net/http

* Address review comments

* refactor: set cookie attrs via setters

* Update ctx.go

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

* Update ctx.go

* Update ctx.go

* Update ctx.go

* Add more unit-tests

* Fix test

* Add default case for samesite

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-06-25 16:50:11 +02:00
Juan Calderon-Perez
f9547df609
Merge pull request #3544 from gofiber/dependabot/go_modules/golang.org/x/net-0.41.0
build(deps): bump golang.org/x/net from 0.40.0 to 0.41.0
2025-06-25 07:18:22 -04:00
dependabot[bot]
2b510897c4
build(deps): bump golang.org/x/net from 0.40.0 to 0.41.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.40.0 to 0.41.0.
- [Commits](https://github.com/golang/net/compare/v0.40.0...v0.41.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-24 12:55:25 +00:00
Kashiwa
0ebe65d711
♻️ refact(state): Use GetState to reduce duplicate code (#3542)
♻️ refact: use GetState to reduce duplicate code
2025-06-23 18:11:29 +02:00
Juan Calderon-Perez
a258661de3
🐛 bug: Fix Subdomains() parsing for IDNs (#3538)
* Use utils.ToLower in Subdomains

* test: cover Unicode fallback path

* fix subdomain extraction for rfc compliance

* Address review comments on Subdomains

* Address review comments
2025-06-23 14:59:34 +02:00
RW
e58db87475
Add custom constraint example (#3539)
docs: add custom constraint example
2025-06-23 12:52:24 +02:00
RW
ad64f2cd8f
Add NewWithCustomCtx initialization helper (#3476)
* Make custom context setup via NewWithCustomCtx

* Update docs/api/app.md

* fix lint issues

* small optimizations

* Fix perf 3476 (#3499)

* perf: modify app.pool

goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   old.txt   │              new.txt               │
                       │   sec/op    │   sec/op     vs base               │
_Communication_Flow-10   36.26n ± 0%   34.51n ± 0%  -4.83% (p=0.000 n=30)

                       │  old.txt   │            new.txt             │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  old.txt   │            new.txt             │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

* perf: optimize defaultCtx in app.next

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   new.txt   │              new4.txt               │
                       │   sec/op    │   sec/op     vs base                │
_Communication_Flow-10   34.51n ± 0%   30.02n ± 0%  -13.01% (p=0.000 n=30)

                       │  new.txt   │            new4.txt            │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  new.txt   │            new4.txt            │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal
```

---------

Co-authored-by: Kashiwa <13825170+ksw2000@users.noreply.github.com>

* Improve performance #3476 (#3532)

* Make custom context setup via NewWithCustomCtx

* Update docs/api/app.md

* fix lint issues

* small optimizations

* perf: modify app.pool

goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   old.txt   │              new.txt               │
                       │   sec/op    │   sec/op     vs base               │
_Communication_Flow-10   36.26n ± 0%   34.51n ± 0%  -4.83% (p=0.000 n=30)

                       │  old.txt   │            new.txt             │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  old.txt   │            new.txt             │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

* perf: optimize defaultCtx in app.next

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │   new.txt   │              new4.txt               │
                       │   sec/op    │   sec/op     vs base                │
_Communication_Flow-10   34.51n ± 0%   30.02n ± 0%  -13.01% (p=0.000 n=30)

                       │  new.txt   │            new4.txt            │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  new.txt   │            new4.txt            │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal
```

* perf: revert nextCustom

```
goos: darwin
goarch: arm64
pkg: github.com/gofiber/fiber/v3
cpu: Apple M4
                       │  head.txt   │            revert-1.txt            │
                       │   sec/op    │   sec/op     vs base               │
_Communication_Flow-10   30.04n ± 0%   28.74n ± 0%  -4.33% (p=0.000 n=30)

                       │  head.txt  │          revert-1.txt          │
                       │    B/op    │    B/op     vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal

                       │  head.txt  │          revert-1.txt          │
                       │ allocs/op  │ allocs/op   vs base            │
_Communication_Flow-10   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=30) ¹
¹ all samples are equal
```

---------

Co-authored-by: RW <rene@gofiber.io>

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Kashiwa <13825170+ksw2000@users.noreply.github.com>
2025-06-23 12:47:52 +02:00
dependabot[bot]
b06ce1327f
build(deps): bump github.com/gofiber/utils/v2 from 2.0.0-beta.8 to 2.0.0-beta.9 (#3540)
build(deps): bump github.com/gofiber/utils/v2

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

---
updated-dependencies:
- dependency-name: github.com/gofiber/utils/v2
  dependency-version: 2.0.0-beta.9
  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>
2025-06-23 12:31:59 +02:00
Juan Calderon-Perez
fcf5755c7c
🐛 bug: Fix Content-Type comparison in Is() (#3536)
* test: validate Is fails for JSON subtype

* Update ctx.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Update ctx.go

* Use immutable-aware getter for Content-Type

* Update ctx.go

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: RW <rene@gofiber.io>
2025-06-23 08:04:21 +02:00
Juan Calderon-Perez
b08d0bfd2f
🐛 bug: Fix Cache-Control header parsing (#3534)
* refactor: use utils.ToLower

* Improve Cache-Control directive matching

* Update middleware/cache/cache.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix lint issue

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-23 07:42:12 +02:00
Juan Calderon-Perez
e1a7c114b2
🧹 chore: Improve CSRF tests coverage (#3531)
test(csrf): cover cookie config warnings
2025-06-20 08:47:57 +02:00
Juan Calderon-Perez
6d16bf5605
🧹chore: Improve BasicAuth middleware default security (#3522)
* Refine BasicAuth middleware

* Fix lint issues

* Update basicauth.md
2025-06-20 08:47:35 +02:00
Juan Calderon-Perez
aea0fd230f
🧹 chore: Improve CORS tests coverage (#3530)
* test(cors): warn when all origins and func

* Fix linter issue
2025-06-20 08:47:05 +02:00
Juan Calderon-Perez
3b2af61152
🧹 chore: Improve Binder tests coverage (#3529)
* Move binder tests into existing file

* Fix lint issues and race condition

* Add nolint directive
2025-06-19 08:28:49 +02:00
Juan Calderon-Perez
c6e0d802f3
🧹 chore: Update codecov configuration (#3528)
* Add root level ignores for codecov

* Update codecov.yml
2025-06-19 08:28:19 +02:00
Juan Calderon-Perez
a68b0e0883
🧹 chore: Improve hooks test coverage (#3524)
* move extra tests into hooks_test

* refactor: reuse mount path constant in tests

* Update test.yml

* Add codecov.yml
2025-06-18 14:56:31 +02:00
Juan Calderon-Perez
528462d2bd
🧹 chore: Add missing CSRF token extractor tests (#3527)
test: cover missing form error
2025-06-18 08:25:05 +02:00
Juan Calderon-Perez
2831d75423
🧹 chore: Improve Retry addon tests coverage (#3526)
* test(retry): achieve full coverage

* Fix lint issue

* Update addon/retry/exponential_backoff_test.go

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

* Update exponential_backoff_test.go

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-06-18 08:24:39 +02:00
Juan Calderon-Perez
eceabc51aa
🧹 chore: Remove repo codecov.yml (#3525)
Remove repo base codecov.yml
2025-06-18 08:24:18 +02:00
Juan Calderon-Perez
a35c5d2e15
🧹 chore: Improve Helmet middleware tests coverage (#3523)
* test: add HSTS coverage

* Update middleware/helmet/helmet_test.go

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

* Update helmet_test.go

* Update helmet_test.go

* Revert test changes

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-06-17 23:24:49 +02:00
Juan Calderon-Perez
0590709556
🧹 chore: Improve Idempotency middleware tests coverage (#3521)
* Consolidate idempotency tests

* Fix lint issues

* Fix more lint issues

* Fix lint issue
2025-06-16 17:45:40 +02:00
Juan Calderon-Perez
1ce3182951
🧹 chore: Improve EarlyData middleware tests coverage (#3520)
* test: move config tests into earlydata_test

* Fix lint issue
2025-06-16 17:44:32 +02:00