mirror of https://github.com/ledisdb/ledisdb.git
modify remote addr
This commit is contained in:
parent
9ad7095e2d
commit
1655f48652
|
@ -19,6 +19,9 @@ var allowedContentTypes = map[string]struct{}{
|
||||||
"bson": struct{}{},
|
"bson": struct{}{},
|
||||||
"msgpack": struct{}{},
|
"msgpack": struct{}{},
|
||||||
}
|
}
|
||||||
|
var unsopportedCommands = map[string]struct{}{
|
||||||
|
"": struct{}{},
|
||||||
|
}
|
||||||
|
|
||||||
type httpClient struct {
|
type httpClient struct {
|
||||||
app *App
|
app *App
|
||||||
|
@ -55,14 +58,7 @@ func newClientHTTP(app *App, w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *httpClient) addr(r *http.Request) string {
|
func (c *httpClient) addr(r *http.Request) string {
|
||||||
addr := r.Header.Get("X-Forwarded-For")
|
return r.RemoteAddr
|
||||||
if addr == "" {
|
|
||||||
addr = r.Header.Get("X-Real-IP")
|
|
||||||
if addr == "" {
|
|
||||||
addr = r.Header.Get("Remote-Addr")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return addr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *httpClient) makeRequest(app *App, r *http.Request, w http.ResponseWriter) (*requestContext, error) {
|
func (c *httpClient) makeRequest(app *App, r *http.Request, w http.ResponseWriter) (*requestContext, error) {
|
||||||
|
|
Loading…
Reference in New Issue