returns whether the referrer from the request is in the host list.
(hosts []string, r *http.Request)
| 446 | |
| 447 | // returns whether the referrer from the request is in the host list. |
| 448 | func referrerMatches(hosts []string, r *http.Request) bool { |
| 449 | u, err := url.Parse(r.Header.Get("Referer")) |
| 450 | if err != nil { // malformed or blank header, just deny |
| 451 | return false |
| 452 | } |
| 453 | |
| 454 | return hostMatches(hosts, u) |
| 455 | } |
| 456 | |
| 457 | // validSignature returns whether the request signature is valid. |
| 458 | func validSignature(key []byte, r *Request) bool { |