contentTypeMatches returns whether contentType matches one of the allowed patterns.
(patterns []string, contentType string)
| 407 | |
| 408 | // contentTypeMatches returns whether contentType matches one of the allowed patterns. |
| 409 | func contentTypeMatches(patterns []string, contentType string) bool { |
| 410 | if len(patterns) == 0 { |
| 411 | return true |
| 412 | } |
| 413 | |
| 414 | for _, pattern := range patterns { |
| 415 | if ok, err := path.Match(pattern, contentType); ok && err == nil { |
| 416 | return true |
| 417 | } |
| 418 | } |
| 419 | |
| 420 | return false |
| 421 | } |
| 422 | |
| 423 | // hostMatches returns whether the host in u matches one of hosts. |
| 424 | func hostMatches(hosts []string, u *url.URL) bool { |
no outgoing calls