checkSameOrigin returns true if the origin is not set or is equal to the request host.
(r *http.Request)
| 87 | |
| 88 | // checkSameOrigin returns true if the origin is not set or is equal to the request host. |
| 89 | func checkSameOrigin(r *http.Request) bool { |
| 90 | origin := r.Header["Origin"] |
| 91 | if len(origin) == 0 { |
| 92 | return true |
| 93 | } |
| 94 | u, err := url.Parse(origin[0]) |
| 95 | if err != nil { |
| 96 | return false |
| 97 | } |
| 98 | return equalASCIIFold(u.Host, r.Host) |
| 99 | } |
| 100 | |
| 101 | func (u *Upgrader) selectSubprotocol(r *http.Request, responseHeader http.Header) string { |
| 102 | if u.Subprotocols != nil { |
searching dependent graphs…