diff options
Diffstat (limited to 'http/handler/handler.go')
-rw-r--r-- | http/handler/handler.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/http/handler/handler.go b/http/handler/handler.go index d698b2e..b88a885 100644 --- a/http/handler/handler.go +++ b/http/handler/handler.go @@ -9,35 +9,30 @@ import ( "time" "github.com/miniflux/miniflux/config" - "github.com/miniflux/miniflux/http/middleware" "github.com/miniflux/miniflux/locale" - "github.com/miniflux/miniflux/logger" "github.com/miniflux/miniflux/storage" "github.com/miniflux/miniflux/template" "github.com/miniflux/miniflux/timer" "github.com/gorilla/mux" - "github.com/tomasen/realip" ) // ControllerFunc is an application HTTP handler. type ControllerFunc func(ctx *Context, request *Request, response *Response) -// Handler manages HTTP handlers and middlewares. +// Handler manages HTTP handlers. type Handler struct { cfg *config.Config store *storage.Storage translator *locale.Translator template *template.Engine router *mux.Router - middleware *middleware.Chain } // Use is a wrapper around an HTTP handler. func (h *Handler) Use(f ControllerFunc) http.Handler { - return h.middleware.WrapFunc(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { defer timer.ExecutionTime(time.Now(), r.URL.Path) - logger.Debug("[HTTP] %s %s %s", realip.RealIP(r), r.Method, r.URL.Path) if r.Header.Get("X-Forwarded-Proto") == "https" { h.cfg.IsHTTPS = true @@ -55,17 +50,16 @@ func (h *Handler) Use(f ControllerFunc) http.Handler { } f(ctx, request, response) - })) + }) } // NewHandler returns a new Handler. -func NewHandler(cfg *config.Config, store *storage.Storage, router *mux.Router, template *template.Engine, translator *locale.Translator, middleware *middleware.Chain) *Handler { +func NewHandler(cfg *config.Config, store *storage.Storage, router *mux.Router, template *template.Engine, translator *locale.Translator) *Handler { return &Handler{ cfg: cfg, store: store, translator: translator, router: router, template: template, - middleware: middleware, } } |