feat: cluster key rate limit enhancement (#1036)

This commit is contained in:
韩贤涛
2024-06-17 10:37:03 +08:00
committed by GitHub
parent 12cc44b324
commit 634de3f7f8
6 changed files with 430 additions and 228 deletions

View File

@@ -43,3 +43,17 @@ func reconvertHeaders(hs map[string][]string) [][2]string {
})
return ret
}
// extractCookieValueByKey 从cookie中提取key对应的value
func extractCookieValueByKey(cookie string, key string) (value string) {
pairs := strings.Split(cookie, ";")
for _, pair := range pairs {
pair = strings.TrimSpace(pair)
kv := strings.Split(pair, "=")
if kv[0] == key {
value = kv[1]
break
}
}
return value
}