MCPcopy
hub / github.com/cloudflare/cloudflared / parseRequestHeaders

Function parseRequestHeaders

cmd/cloudflared/access/validation.go:16–25  ·  view source on GitHub ↗

parseRequestHeaders will take user-provided header values as strings "Content-Type: application/json" and create a http.Header object.

(values []string)

Source from the content-addressed store, hash-verified

14// parseRequestHeaders will take user-provided header values as strings "Content-Type: application/json" and create
15// a http.Header object.
16func parseRequestHeaders(values []string) http.Header {
17 headers := make(http.Header)
18 for _, valuePair := range values {
19 header, value, found := strings.Cut(valuePair, ":")
20 if found {
21 headers.Add(strings.TrimSpace(header), strings.TrimSpace(value))
22 }
23 }
24 return headers
25}
26
27// bracketBareIPv6 wraps bare IPv6 addresses in a URL with square brackets.
28// Go 1.26 tightened net/url parsing to strictly require RFC 3986 bracket syntax

Callers 3

TestParseRequestHeadersFunction · 0.85
verifyTokenAtEdgeFunction · 0.85
sshFunction · 0.85

Calls 1

AddMethod · 0.65

Tested by 1

TestParseRequestHeadersFunction · 0.68