From 1655f48652c98682fb82f1827f121df427cfc48f Mon Sep 17 00:00:00 2001 From: wenyekui Date: Mon, 4 Aug 2014 10:28:09 +0800 Subject: [PATCH] modify remote addr --- server/client_http.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/server/client_http.go b/server/client_http.go index a99b62c..db4595d 100644 --- a/server/client_http.go +++ b/server/client_http.go @@ -19,6 +19,9 @@ var allowedContentTypes = map[string]struct{}{ "bson": struct{}{}, "msgpack": struct{}{}, } +var unsopportedCommands = map[string]struct{}{ + "": struct{}{}, +} type httpClient struct { app *App @@ -55,14 +58,7 @@ func newClientHTTP(app *App, w http.ResponseWriter, r *http.Request) { } func (c *httpClient) addr(r *http.Request) string { - addr := r.Header.Get("X-Forwarded-For") - if addr == "" { - addr = r.Header.Get("X-Real-IP") - if addr == "" { - addr = r.Header.Get("Remote-Addr") - } - } - return addr + return r.RemoteAddr } func (c *httpClient) makeRequest(app *App, r *http.Request, w http.ResponseWriter) (*requestContext, error) {