1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Rewrite RealIP() to avoid returning an empty string

This commit is contained in:
Frédéric Guillot 2018-06-01 07:22:18 -07:00
parent cf7a7e25fb
commit 3b39f0883c
11 changed files with 117 additions and 255 deletions

View file

@ -7,15 +7,14 @@ package middleware
import (
"net/http"
"github.com/miniflux/miniflux/http/request"
"github.com/miniflux/miniflux/logger"
"github.com/tomasen/realip"
)
// Logging logs the HTTP request.
func (m *Middleware) Logging(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
logger.Debug("[HTTP] %s %s %s", realip.RealIP(r), r.Method, r.RequestURI)
logger.Debug("[HTTP] %s %s %s", request.RealIP(r), r.Method, r.RequestURI)
next.ServeHTTP(w, r)
})
}