Pull request: 2343 http server

Merge in DNS/adguard-home from 2343-http-server to master

Closes .

Squashed commit of the following:

commit f4ebfc129484fc3489409069b3580eb70d71cc74
Merge: b13ec7002 36c7735b8
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 25 15:37:27 2020 +0300

    Merge branch 'master' into 2343-http-server

commit b13ec70024f24f6b68b13a1ec6f27c89535feaf8
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 25 15:31:36 2020 +0300

    all: record changes

commit ce44aac9d43e32db3f68746dec7a4f21b0a9dea4
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Wed Nov 25 14:00:45 2020 +0300

    home: set http servers timeouts

commit 7f3e7385d1df39b39713b8ec443da5d9374d0bc8
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Tue Nov 24 19:58:56 2020 +0300

    home: replace default ServeMux with custom one.
This commit is contained in:
Eugene Burkov 2020-11-25 15:50:59 +03:00
parent 36c7735b85
commit b4a35fa887
8 changed files with 62 additions and 34 deletions
internal/home

View file

@ -2,7 +2,6 @@ package home
import (
"net/http"
"strings"
"github.com/AdguardTeam/AdGuardHome/internal/aghio"
@ -41,19 +40,3 @@ func limitRequestBody(h http.Handler) (limited http.Handler) {
h.ServeHTTP(w, r)
})
}
// TODO(a.garipov): We currently have to use this, because everything registers
// its HTTP handlers in http.DefaultServeMux. In the future, refactor our HTTP
// API initialization process and stop using the gosh darn http.DefaultServeMux
// for anything at all. Gosh darn global variables.
func filterPProf(h http.Handler) (filtered http.Handler) {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(r.URL.Path, "/debug/pprof") {
http.NotFound(w, r)
return
}
h.ServeHTTP(w, r)
})
}