Skip to content

Commit

Permalink
RHINENG-11685: remove temp debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Dugowitch committed Aug 22, 2024
1 parent 722bf91 commit d03dade
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 19 deletions.
4 changes: 0 additions & 4 deletions manager/middlewares/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

func LimitRequestBodySize(size int64) gin.HandlerFunc {
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "LimitRequestBodySize")
if c.Request != nil && c.Request.Body != nil {
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, size)
}
Expand All @@ -20,7 +19,6 @@ func LimitRequestBodySize(size int64) gin.HandlerFunc {

func LimitRequestHeaders(maxHeaderCount int) gin.HandlerFunc {
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "LimitRequestHeaders")
if len(c.Request.Header) > maxHeaderCount {
c.AbortWithStatusJSON(http.StatusRequestEntityTooLarge, utils.ErrorResponse{Error: "too many headers"})
}
Expand All @@ -30,7 +28,6 @@ func LimitRequestHeaders(maxHeaderCount int) gin.HandlerFunc {
func MaxConnections(max int) gin.HandlerFunc {
conns := make(chan struct{}, max)
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "MaxConnections")
conns <- struct{}{}
defer func() { <-conns }()
c.Next()
Expand All @@ -40,7 +37,6 @@ func MaxConnections(max int) gin.HandlerFunc {
func Ratelimit(max int) gin.HandlerFunc {
rl := ratelimit.New(max)
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "Ratelimit")
rl.Take()
c.Next()
}
Expand Down
13 changes: 0 additions & 13 deletions manager/middlewares/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,10 @@ func RBAC() gin.HandlerFunc {
}

return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "RBAC")
if isAccessGranted(c) {
return
}
c.AbortWithStatusJSON(http.StatusUnauthorized,
utils.ErrorResponse{Error: "You don't have access to this application"})
}
}

func tempLogDebugGinContextRequestHeader(c *gin.Context, origin string) {
if c != nil {
if c.Request != nil {
utils.LogDebug("origin", origin, "gin_context_req_header", c.Request.Header, "gin context request handler")
} else {
utils.LogDebug("origin", origin, "gin_context_req", nil, "gin context request handler")
}
} else {
utils.LogDebug("origin", origin, "gin_context", nil, "gin context request handler")
}
}
2 changes: 0 additions & 2 deletions manager/middlewares/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ func WithTimeout(seconds time.Duration) gin.HandlerFunc {
return timeout.New(
timeout.WithTimeout(seconds*time.Second),
timeout.WithHandler(func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "TimeoutWithHandler")
c.Next()
}),
timeout.WithResponse(func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "TimeoutWithResponse")
c.AbortWithStatusJSON(http.StatusRequestTimeout, utils.ErrorResponse{Error: "Request timeout"})
c.Done()
}),
Expand Down

0 comments on commit d03dade

Please sign in to comment.