// validWireHeaderFieldName reports whether v is a valid header field // name (key). See httplex.ValidHeaderName for the base rules. // // Further, http2 says: // "Just as in HTTP/1.x, header field names are strings of ASCII // characters that are compared in a case-insensitive // fashion. However, header field names MUST be converted to // lowercase prior to their encoding in HTTP/2. " func validWireHeaderFieldName(v string) bool { if len(v) == 0 { return false } for _, r := range v { if !httplex.IsTokenRune(r) { return false } if 'A' <= r && r <= 'Z' { return false } } return true }
func isNotToken(r rune) bool { return !httplex.IsTokenRune(r) }