[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r4351: Unescape quoted values received in response to GETCONF and G (vidalia/trunk/src/torcontrol)
Author: edmanm
Date: 2010-07-14 11:45:22 -0400 (Wed, 14 Jul 2010)
New Revision: 4351
Modified:
vidalia/trunk/src/torcontrol/TorControl.cpp
Log:
Unescape quoted values received in response to GETCONF and GETINFO commands.
Modified: vidalia/trunk/src/torcontrol/TorControl.cpp
===================================================================
--- vidalia/trunk/src/torcontrol/TorControl.cpp 2010-07-14 15:43:39 UTC (rev 4350)
+++ vidalia/trunk/src/torcontrol/TorControl.cpp 2010-07-14 15:45:22 UTC (rev 4351)
@@ -423,7 +423,16 @@
/* Split the "key=val" line and map them */
QStringList keyval = line.getMessage().split("=");
if (keyval.size() == 2) {
- map.insert(keyval.at(0), keyval.at(1));
+ QString key = keyval.at(0);
+ QString val = keyval.at(1);
+ if (val.startsWith(QLatin1Char('\"')) &&
+ val.endsWith(QLatin1Char('\"'))) {
+ bool ok;
+ val = string_unescape(val, &ok);
+ if (! ok)
+ continue;
+ }
+ map.insert(key, val);
}
}
return true;
@@ -451,8 +460,17 @@
QString key = msg.mid(0, index);
QStringList val;
- if (index > 0 && index < msg.length()-1)
- val << msg.mid(index+1);
+ if (index > 0 && index < msg.length()-1) {
+ QString str = msg.mid(index+1);
+ if (str.startsWith(QLatin1Char('\"')) &&
+ str.endsWith(QLatin1Char('\"'))) {
+ bool ok;
+ str = string_unescape(str, &ok);
+ if (! ok)
+ continue;
+ }
+ val << str;
+ }
if (line.hasData())
val << line.getData();
@@ -805,6 +823,13 @@
if (index > 0 && index < msg.length()-1)
val = msg.mid(index+1);
+ if (val.startsWith(QLatin1Char('\"')) &&
+ val.endsWith(QLatin1Char('\"'))) {
+ bool ok;
+ val = string_unescape(val, &ok);
+ if (! ok)
+ continue;
+ }
if (confMap.contains(key)) {
QStringList values = confMap.value(key).toStringList();