mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-02 22:35:59 +00:00
derp/derphttp: only log about a weird upgrade if any was specified
Otherwise random browser requests to /derp cause log spam. Change-Id: I7bdf991d2106f0323868e651156c788a877a90d5 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
81cabf48ec
commit
eebe7afad7
@ -23,7 +23,9 @@ func Handler(s *derp.Server) http.Handler {
|
|||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
up := strings.ToLower(r.Header.Get("Upgrade"))
|
up := strings.ToLower(r.Header.Get("Upgrade"))
|
||||||
if up != "websocket" && up != "derp" {
|
if up != "websocket" && up != "derp" {
|
||||||
log.Printf("Weird upgrade: %q", up)
|
if up != "" {
|
||||||
|
log.Printf("Weird upgrade: %q", up)
|
||||||
|
}
|
||||||
http.Error(w, "DERP requires connection upgrade", http.StatusUpgradeRequired)
|
http.Error(w, "DERP requires connection upgrade", http.StatusUpgradeRequired)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user