Commit Graph

16 Commits

Author SHA1 Message Date
nickajacks1 868ee455d5 feat: add function to parse HTTP header parameters (#1685)
* feat: add function to parse HTTP header parameters

The implementation is based on RFC-9110 5.6.6.

* test: add fuzz for VisitHeaderParams
2024-01-02 09:43:40 +01:00
Oleksandr Redko 9d6b470260 chore: Add missing dots at the end of comments (#1677) 2023-12-13 13:56:24 +08:00
Oleksandr Redko ffdf59d04c Enable gofumpt linter; format code gofumpt -w . (#1576) 2023-06-13 15:18:59 +02:00
Sergey Ponomarev 66cd5022fd header.go Referer() optimize (#1313)
* args.go GetBool(): use switch with string casting

This should be optimized by Go compiler itself so the b2s() call is not needed.

It was previously done by this but changed in
1e7885eb56

* header.go Referer() optimize

Use direct peekArgBytes() instead of PeekBytes() that will check for special headers

* header_timing_test.go BenchmarkRequestHeaderPeekBytesSpecialHeader

The old BenchmarkRequestHeaderPeekBytesCanonical and BenchmarkRequestHeaderPeekBytesNonCanonical are in fact just measured the header normalization.
But it's anyway is benchmarked separately.
Results was almost the same: 1.5 ns/op.

Instead, let's reuse the benches to find a difference between peeking of special (Host, CT) and custom headers.
2022-06-06 08:46:49 +02:00
Erik Dubbelboer 7a5afddf5b Use %v for errors and %q for strings (#1262)
Mostly in tests.
2022-04-01 18:11:16 +02:00
tyltr f0a21893b9 feat: improve IsMethod (#1088)
* feat: improve bytesEqual

* benchmark

* nolint:unused

* remove unused  code

* Update client.go

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2021-09-06 12:06:21 +02:00
Kirill Danshin d0dfbd4494 fix issue #875 (#909)
* 🐞 panic in fs.go #824

* fix issue #875

Signed-off-by: Kirill Danshin <kirill@danshin.pro>

* improve issue 875

Co-authored-by: Fenny <fenny@gofiber.io>

* Update header.go

* Update header.go

Co-authored-by: Kirill Danshin <kirill@danshin.pro>

* remove foldReplacer

* Improve removeNewLines

Start replacing at the first character found, use bytes.Indexbyte to
make the function signature more logical. Both bytes.indexByte and
strings.IndexByte use exactly the same code:
https://github.com/golang/go/blob/0c703b37dffe74d3fffc04347884bb0ee2fba5b3/src/internal/bytealg/indexbyte_amd64.s#L8-L20

Co-authored-by: wernerr <rene.werner@verivox.com>
Co-authored-by: wernerr <rene@gofiber.io>
Co-authored-by: Fenny <fenny@gofiber.io>
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2020-12-09 16:59:57 +01:00
Erik Dubbelboer d4f0cf56d8 Remove fasthttp.ByteBuffer
As advertised in https://github.com/valyala/fasthttp/commit/b5f96d4b4120bb1e09c23ac32baf21a14da4a71d
2018-10-01 14:15:29 +08:00
Aliaksandr Valialkin dd6954f4b2 Issue #57: Server: added ability to disable header names' normalizing 2016-02-25 14:00:04 +02:00
Aliaksandr Valialkin 80368e6491 Switch from bytes.Buffer to ByteBuffer where appropriate 2016-02-12 14:07:56 +02:00
Aliaksandr Valialkin a3b2aca075 Added benchmarks for normalizeHeaderKey 2015-11-30 20:25:39 +02:00
Aliaksandr Valialkin 96b9f2cd84 gofmt 2015-11-22 04:33:57 +02:00
Aliaksandr Valialkin e4478bf22e Added tests for Header.Write 2015-11-22 02:41:27 +02:00
Aliaksandr Valialkin 93d8598806 Run header benchmarks in parallel 2015-11-17 08:48:33 +02:00
Aliaksandr Valialkin 9fc0d48181 Added benchmarks for header reading 2015-11-05 14:26:16 +02:00
Aliaksandr Valialkin 9a0044fba4 Added benchmarks for obtaining header values for normalized and non-normalized keys 2015-10-28 18:07:23 +02:00