(requestURL string, matchURL string)
| 204 | } |
| 205 | |
| 206 | func pluginStoreURLMatchesAuthRule(requestURL string, matchURL string) bool { |
| 207 | request, errRequest := url.Parse(strings.TrimSpace(requestURL)) |
| 208 | if errRequest != nil || request.Scheme == "" || request.Host == "" { |
| 209 | return false |
| 210 | } |
| 211 | rule, errRule := url.Parse(strings.TrimSpace(matchURL)) |
| 212 | if errRule != nil || rule.Scheme == "" || rule.Host == "" { |
| 213 | return false |
| 214 | } |
| 215 | if !strings.EqualFold(request.Scheme, rule.Scheme) || !strings.EqualFold(request.Host, rule.Host) { |
| 216 | return false |
| 217 | } |
| 218 | return pluginStorePathMatchesAuthRule(request.Path, rule.Path) |
| 219 | } |
| 220 | |
| 221 | func pluginStorePathMatchesAuthRule(requestPath string, rulePath string) bool { |
| 222 | if rulePath == "" || rulePath == "/" { |
no test coverage detected