From 93761d8ff3648ed05946ae42f510ab4f3f8a34f7 Mon Sep 17 00:00:00 2001 From: wenyekui Date: Mon, 4 Aug 2014 10:38:43 +0800 Subject: [PATCH] http interface: unsupport repl cmds --- server/client_http.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/client_http.go b/server/client_http.go index db4595d..b37700e 100644 --- a/server/client_http.go +++ b/server/client_http.go @@ -20,7 +20,9 @@ var allowedContentTypes = map[string]struct{}{ "msgpack": struct{}{}, } var unsopportedCommands = map[string]struct{}{ - "": struct{}{}, + "slaveof": struct{}{}, + "fullsync": struct{}{}, + "sync": struct{}{}, } type httpClient struct { @@ -84,10 +86,10 @@ func (c *httpClient) makeRequest(app *App, r *http.Request, w http.ResponseWrite } req.cmd = strings.ToLower(cmd) - - if req.cmd == "slaveof" || req.cmd == "fullsync" || req.cmd == "sync" { + if _, ok := unsopportedCommands[req.cmd]; ok { return nil, fmt.Errorf("unsupported command: '%s'", cmd) } + req.args = args req.remoteAddr = c.addr(r)