aboutsummaryrefslogtreecommitdiff
path: root/header_timing_test.go
diff options
context:
space:
mode:
authorGravatar nickajacks1 <128185314+nickajacks1@users.noreply.github.com> 2024-01-02 00:43:40 -0800
committerGravatar GitHub <noreply@github.com> 2024-01-02 09:43:40 +0100
commit868ee455d5f9b5ffebae03906d581eb360f5d835 (patch)
treed1aa9e56bfc7141ef1d9ccdd911ef03c269d26ef /header_timing_test.go
parentchore(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#1678) (diff)
downloadfasthttp-868ee455d5f9b5ffebae03906d581eb360f5d835.tar.gz
fasthttp-868ee455d5f9b5ffebae03906d581eb360f5d835.tar.bz2
fasthttp-868ee455d5f9b5ffebae03906d581eb360f5d835.zip
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
Diffstat (limited to 'header_timing_test.go')
-rw-r--r--header_timing_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/header_timing_test.go b/header_timing_test.go
index 66698c4..90f65ae 100644
--- a/header_timing_test.go
+++ b/header_timing_test.go
@@ -180,6 +180,19 @@ func benchmarkNormalizeHeaderKey(b *testing.B, src []byte) {
})
}
+func BenchmarkVisitHeaderParams(b *testing.B) {
+ var h RequestHeader
+ h.SetBytesKV(strContentType, []byte(`text/plain ; foo=bar ; param2="dquote is: [\"], ok?" ; version=1; q=0.324 `))
+
+ header := h.ContentType()
+ b.ReportAllocs()
+ b.ResetTimer()
+
+ for n := 0; n < b.N; n++ {
+ VisitHeaderParams(header, func(key, value []byte) bool { return true })
+ }
+}
+
func BenchmarkRemoveNewLines(b *testing.B) {
type testcase struct {
value string