forked from mirror/ledisdb
http interface: unsupport repl cmds
This commit is contained in:
parent
1655f48652
commit
93761d8ff3
|
@ -20,7 +20,9 @@ var allowedContentTypes = map[string]struct{}{
|
||||||
"msgpack": struct{}{},
|
"msgpack": struct{}{},
|
||||||
}
|
}
|
||||||
var unsopportedCommands = map[string]struct{}{
|
var unsopportedCommands = map[string]struct{}{
|
||||||
"": struct{}{},
|
"slaveof": struct{}{},
|
||||||
|
"fullsync": struct{}{},
|
||||||
|
"sync": struct{}{},
|
||||||
}
|
}
|
||||||
|
|
||||||
type httpClient 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)
|
req.cmd = strings.ToLower(cmd)
|
||||||
|
if _, ok := unsopportedCommands[req.cmd]; ok {
|
||||||
if req.cmd == "slaveof" || req.cmd == "fullsync" || req.cmd == "sync" {
|
|
||||||
return nil, fmt.Errorf("unsupported command: '%s'", cmd)
|
return nil, fmt.Errorf("unsupported command: '%s'", cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
req.args = args
|
req.args = args
|
||||||
|
|
||||||
req.remoteAddr = c.addr(r)
|
req.remoteAddr = c.addr(r)
|
||||||
|
|
Loading…
Reference in New Issue