MCPcopy Create free account
hub / github.com/gobwas/httphead / ParseHeaderLine

Function ParseHeaderLine

head.go:180–193  ·  view source on GitHub ↗

ParseHeaderLine parses HTTP header as key-value pair. It returns parsed values and true if parse is ok.

(line []byte)

Source from the content-addressed store, hash-verified

178// ParseHeaderLine parses HTTP header as key-value pair. It returns parsed
179// values and true if parse is ok.
180func ParseHeaderLine(line []byte) (k, v []byte, ok bool) {
181 colon := bytes.IndexByte(line, ':')
182 if colon == -1 {
183 return
184 }
185 k = trim(line[:colon])
186 for _, c := range k {
187 if !OctetTypes[c].IsToken() {
188 return nil, nil, false
189 }
190 }
191 v = trim(line[colon+1:])
192 return k, v, true
193}
194
195// IntFromASCII converts ascii encoded decimal numeric value from HTTP entities
196// to an integer.

Callers

nothing calls this directly

Calls 2

trimFunction · 0.85
IsTokenMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…