aboutsummaryrefslogtreecommitdiff
path: root/header.go
diff options
context:
space:
mode:
authorGravatar nickajacks1 <128185314+nickajacks1@users.noreply.github.com> 2024-01-06 23:27:45 -0800
committerGravatar GitHub <noreply@github.com> 2024-01-07 08:27:45 +0100
commit2accefa5cb4af19c2ac477a6b1b16554018cd223 (patch)
treee6feb647e2085023181a6b5cd9eb644c8d17b634 /header.go
parentAdd CIFuzz (#1443) (diff)
downloadfasthttp-2accefa5cb4af19c2ac477a6b1b16554018cd223.tar.gz
fasthttp-2accefa5cb4af19c2ac477a6b1b16554018cd223.tar.bz2
fasthttp-2accefa5cb4af19c2ac477a6b1b16554018cd223.zip
refactor: move manually created tchar table to bytesconv_table_gen (#1689)
Diffstat (limited to 'header.go')
-rw-r--r--header.go21
1 files changed, 1 insertions, 20 deletions
diff --git a/header.go b/header.go
index 16d6a6c..ac279d7 100644
--- a/header.go
+++ b/header.go
@@ -548,26 +548,7 @@ func (h *ResponseHeader) AddTrailerBytes(trailer []byte) error {
// validHeaderFieldByte returns true if c is a valid tchar as defined
// by section 5.6.2 of [RFC9110].
func validHeaderFieldByte(c byte) bool {
- return c < 128 && tcharTable[c]
-}
-
-// tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
-// / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
-// / DIGIT / ALPHA
-//
-// See: https://www.rfc-editor.org/rfc/rfc9110#tokens
-var tcharTable = [128]bool{
- '!': true, '#': true, '$': true, '%': true, '&': true, '\'': true, '*': true, '+': true,
- '-': true, '.': true, '^': true, '_': true, '`': true, '|': true, '~': true,
- '0': true, '1': true, '2': true, '3': true, '4': true, '5': true, '6': true, '7': true, '8': true, '9': true,
- 'A': true, 'B': true, 'C': true, 'D': true, 'E': true, 'F': true, 'G': true,
- 'H': true, 'I': true, 'J': true, 'K': true, 'L': true, 'M': true, 'N': true,
- 'O': true, 'P': true, 'Q': true, 'R': true, 'S': true, 'T': true, 'U': true,
- 'V': true, 'W': true, 'X': true, 'Y': true, 'Z': true,
- 'a': true, 'b': true, 'c': true, 'd': true, 'e': true, 'f': true, 'g': true,
- 'h': true, 'i': true, 'j': true, 'k': true, 'l': true, 'm': true, 'n': true,
- 'o': true, 'p': true, 'q': true, 'r': true, 's': true, 't': true, 'u': true,
- 'v': true, 'w': true, 'x': true, 'y': true, 'z': true,
+ return c < 128 && tcharTable[c] == 1
}
// VisitHeaderParams calls f for each parameter in the given header bytes.