MCPcopy
hub / github.com/gorilla/websocket / tokenListContainsValue

Function tokenListContainsValue

util.go:202–225  ·  view source on GitHub ↗

tokenListContainsValue returns true if the 1#token header with the given name contains a token equal to value with ASCII case folding.

(header http.Header, name string, value string)

Source from the content-addressed store, hash-verified

200// tokenListContainsValue returns true if the 1#token header with the given
201// name contains a token equal to value with ASCII case folding.
202func tokenListContainsValue(header http.Header, name string, value string) bool {
203headers:
204 for _, s := range header[name] {
205 for {
206 var t string
207 t, s = nextToken(skipSpace(s))
208 if t == "" {
209 continue headers
210 }
211 s = skipSpace(s)
212 if s != "" && s[0] != ',' {
213 continue headers
214 }
215 if equalASCIIFold(t, value) {
216 return true
217 }
218 if s == "" {
219 continue headers
220 }
221 s = s[1:]
222 }
223 }
224 return false
225}
226
227// parseExtensions parses WebSocket extensions from a header.
228func parseExtensions(header http.Header) []map[string]string {

Callers 4

UpgradeMethod · 0.85
IsWebSocketUpgradeFunction · 0.85
DialContextMethod · 0.85

Calls 3

nextTokenFunction · 0.85
skipSpaceFunction · 0.85
equalASCIIFoldFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…