MCPcopy
hub / github.com/mudler/LocalAI / firstToken

Function firstToken

core/http/middleware/baseurl.go:91–96  ·  view source on GitHub ↗

firstToken returns the first comma-separated token of v, trimmed of spaces. Reverse-proxy chains can emit X-Forwarded-Proto as "https,http"; only the first hop (closest to the client) is meaningful for scheme detection.

(v string)

Source from the content-addressed store, hash-verified

89// Reverse-proxy chains can emit X-Forwarded-Proto as "https,http"; only the
90// first hop (closest to the client) is meaningful for scheme detection.
91func firstToken(v string) string {
92 if i := strings.IndexByte(v, ','); i >= 0 {
93 v = v[:i]
94 }
95 return strings.TrimSpace(v)
96}
97
98// parseForwarded extracts the proto and host directives from the first element
99// of an RFC 7239 Forwarded header (e.g. `for=x;proto=https;host=h, for=y`).

Callers 2

BaseURLFunction · 0.85
baseurl_test.goFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected