ClientProcess: close connection when client sends HTTP request

This commit is contained in:
Max Kellermann 2014-08-12 14:39:30 +02:00 committed by Max Kellermann
parent b177bffa6a
commit ab05b70423
2 changed files with 10 additions and 0 deletions

1
NEWS
View File

@ -2,6 +2,7 @@ ver 0.21 (not yet released)
* protocol * protocol
- "tagtypes" can be used to hide tags - "tagtypes" can be used to hide tags
- "find" and "search" can sort - "find" and "search" can sort
- close connection when client sends HTTP request
* tags * tags
- new tag "OriginalDate" - new tag "OriginalDate"
* decoder * decoder

View File

@ -23,6 +23,7 @@
#include "command/AllCommands.hxx" #include "command/AllCommands.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
#include "util/CharUtil.hxx"
#define CLIENT_LIST_MODE_BEGIN "command_list_begin" #define CLIENT_LIST_MODE_BEGIN "command_list_begin"
#define CLIENT_LIST_OK_MODE_BEGIN "command_list_ok_begin" #define CLIENT_LIST_OK_MODE_BEGIN "command_list_ok_begin"
@ -118,6 +119,14 @@ client_process_line(Client &client, char *line)
} else if (StringIsEqual(line, CLIENT_LIST_OK_MODE_BEGIN)) { } else if (StringIsEqual(line, CLIENT_LIST_OK_MODE_BEGIN)) {
client.cmd_list.Begin(true); client.cmd_list.Begin(true);
ret = CommandResult::OK; 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\"",
client.num, line);
ret = CommandResult::CLOSE;
} else { } else {
FormatDebug(client_domain, FormatDebug(client_domain,
"[%u] process command \"%s\"", "[%u] process command \"%s\"",