mirror of https://github.com/tidwall/redcon.git
do not lcase command
This commit is contained in:
parent
0ec132aed9
commit
8d2bcf15cc
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/tidwall/redcon"
|
"github.com/tidwall/redcon"
|
||||||
|
@ -16,7 +17,7 @@ func main() {
|
||||||
err := redcon.ListenAndServe(addr,
|
err := redcon.ListenAndServe(addr,
|
||||||
func(conn redcon.Conn, commands [][]string) {
|
func(conn redcon.Conn, commands [][]string) {
|
||||||
for _, args := range commands {
|
for _, args := range commands {
|
||||||
switch args[0] {
|
switch strings.ToLower(args[0]) {
|
||||||
default:
|
default:
|
||||||
conn.WriteError("ERR unknown command '" + args[0] + "'")
|
conn.WriteError("ERR unknown command '" + args[0] + "'")
|
||||||
case "ping":
|
case "ping":
|
||||||
|
|
10
redcon.go
10
redcon.go
|
@ -276,8 +276,7 @@ func handle(
|
||||||
}
|
}
|
||||||
shandler(c, scmds)
|
shandler(c, scmds)
|
||||||
} else if bhandler != nil {
|
} else if bhandler != nil {
|
||||||
// copy the byte commands once, before exposing to the
|
// copy the byte commands once, before exposing to client.
|
||||||
// client.
|
|
||||||
for i := 0; i < len(cmds); i++ {
|
for i := 0; i < len(cmds); i++ {
|
||||||
for j := 0; j < len(cmds[i]); j++ {
|
for j := 0; j < len(cmds[i]); j++ {
|
||||||
nb := make([]byte, len(cmds[i][j]))
|
nb := make([]byte, len(cmds[i][j]))
|
||||||
|
@ -493,13 +492,6 @@ func (r *reader) ReadCommands() ([][][]byte, error) {
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
arg := b[i : i+ni2]
|
arg := b[i : i+ni2]
|
||||||
if len(args) == 0 {
|
|
||||||
for j := 0; j < len(arg); j++ {
|
|
||||||
if arg[j] >= 'A' && arg[j] <= 'Z' {
|
|
||||||
arg[j] += 32
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i += ni2 + 1
|
i += ni2 + 1
|
||||||
args = append(args, arg)
|
args = append(args, arg)
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue