aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-04 18:11:15 +0100
committerMax Kellermann <max@duempel.org>2013-11-04 18:11:15 +0100
commiteab1a776838815b4d7b1ac01cc7bcf5f56d3bfd9 (patch)
tree9c1e2781ec63f129df424dbaa8b313f12dc071ca
parent84f5e0c0de1f4adda01b63095979d5d0e3e00593 (diff)
downloadmpd-eab1a776838815b4d7b1ac01cc7bcf5f56d3bfd9.tar.gz
mpd-eab1a776838815b4d7b1ac01cc7bcf5f56d3bfd9.tar.xz
mpd-eab1a776838815b4d7b1ac01cc7bcf5f56d3bfd9.zip
ClientRead: always ignore whitespace at the end of the line
-rw-r--r--NEWS2
-rw-r--r--src/ClientRead.cxx9
2 files changed, 9 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 35b59e184..316226ea3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
ver 0.18.1 (2013/11/??)
+* protocol:
+ - always ignore whitespace at the end of the line
* filter:
- autoconvert: fix "volume_normalization" with mp3 files
* add missing files to source tarball
diff --git a/src/ClientRead.cxx b/src/ClientRead.cxx
index 2bb3c56c0..925e1502d 100644
--- a/src/ClientRead.cxx
+++ b/src/ClientRead.cxx
@@ -21,6 +21,7 @@
#include "ClientInternal.hxx"
#include "Main.hxx"
#include "event/Loop.hxx"
+#include "util/CharUtil.hxx"
#include <assert.h>
#include <string.h>
@@ -35,11 +36,15 @@ Client::OnSocketInput(void *data, size_t length)
TimeoutMonitor::ScheduleSeconds(client_timeout);
+ BufferedSocket::ConsumeInput(newline + 1 - p);
+
+ /* skip whitespace at the end of the line */
+ while (newline > p && IsWhitespaceOrNull(newline[-1]))
+ --newline;
+
/* terminate the string at the end of the line */
*newline = 0;
- BufferedSocket::ConsumeInput(newline + 1 - p);
-
CommandResult result = client_process_line(*this, p);
switch (result) {
case CommandResult::OK: