client/Process: move basic syntax check to the beginning of method
This catches lines within command lists as well.
This commit is contained in:
parent
d9117a272b
commit
f339a53e3c
@ -55,6 +55,16 @@ Client::ProcessCommandList(bool list_ok,
|
||||
CommandResult
|
||||
Client::ProcessLine(char *line) noexcept
|
||||
{
|
||||
if (IsUpperAlphaASCII(*line)) {
|
||||
/* no valid MPD command begins with an upper case
|
||||
letter; this could be a badly routed HTTP
|
||||
request */
|
||||
FormatWarning(client_domain,
|
||||
"[%u] malformed command \"%s\"",
|
||||
num, line);
|
||||
return CommandResult::CLOSE;
|
||||
}
|
||||
|
||||
CommandResult ret;
|
||||
|
||||
if (StringIsEqual(line, "noidle")) {
|
||||
@ -119,14 +129,6 @@ Client::ProcessLine(char *line) noexcept
|
||||
} else if (StringIsEqual(line, CLIENT_LIST_OK_MODE_BEGIN)) {
|
||||
cmd_list.Begin(true);
|
||||
ret = CommandResult::OK;
|
||||
} else if (IsUpperAlphaASCII(*line)) {
|
||||
/* no valid MPD command begins with an upper
|
||||
case letter; this could be a badly routed
|
||||
HTTP request */
|
||||
FormatWarning(client_domain,
|
||||
"[%u] malformed command \"%s\"",
|
||||
num, line);
|
||||
ret = CommandResult::CLOSE;
|
||||
} else {
|
||||
FormatDebug(client_domain,
|
||||
"[%u] process command \"%s\"",
|
||||
|
Loading…
Reference in New Issue
Block a user