MCPcopy Index your code
hub / github.com/syncthing/syncthing / localhostMiddleware

Function localhostMiddleware

lib/api/api.go:621–630  ·  view source on GitHub ↗
(h http.Handler)

Source from the content-addressed store, hash-verified

619}
620
621func localhostMiddleware(h http.Handler) http.Handler {
622 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
623 if addressIsLocalhost(r.Host) {
624 h.ServeHTTP(w, r)
625 return
626 }
627
628 http.Error(w, "Host check error", http.StatusForbidden)
629 })
630}
631
632func (s *service) getPendingDevices(w http.ResponseWriter, _ *http.Request) {
633 devices, err := s.model.PendingDevices()

Callers 1

ServeMethod · 0.85

Calls 3

addressIsLocalhostFunction · 0.85
ErrorMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected