Skip to content

Commit

Permalink
Fix #4373 : add comment
Browse files Browse the repository at this point in the history
Signed-off-by: Cabinfever_B <cabinfeveroier@gmail.com>
  • Loading branch information
CabinfeverB committed Dec 20, 2021
1 parent 1c186dd commit 2a10ed3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/apiutil/serverapi/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ func IsServiceAllowed(s *server.Server, group server.ServiceGroup) bool {
return false
}

type selfProtector struct {
s *server.Server
}

func NewSelfProtector(s *server.Server) negroni.Handler {
return &selfProtector{s: s}
}

func (protector *selfProtector) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
if protector.s.SelfProtectionHandler.SelfProtectionHandleHTTP(r) {
next(w, r)
} else {
http.Error(w, http.StatusText(http.StatusTooManyRequests), http.StatusTooManyRequests)
}
}

type redirector struct {
s *server.Server
}
Expand Down

0 comments on commit 2a10ed3

Please sign in to comment.