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)
| 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. |
| 91 | func 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`). |
no outgoing calls
no test coverage detected