fix for parsing http query parameters, added support for "exact" http query parameter
This commit is contained in:
+11
-10
@@ -881,6 +881,7 @@ string MainLoop::executeGet(vector<string> &args, bool& connected)
|
|||||||
}
|
}
|
||||||
time_t since = 0;
|
time_t since = 0;
|
||||||
unsigned char pollPriority = 0;
|
unsigned char pollPriority = 0;
|
||||||
|
bool exact = false;
|
||||||
if (args.size() > argPos) {
|
if (args.size() > argPos) {
|
||||||
string query = args[argPos++];
|
string query = args[argPos++];
|
||||||
istringstream stream(query);
|
istringstream stream(query);
|
||||||
@@ -888,21 +889,21 @@ string MainLoop::executeGet(vector<string> &args, bool& connected)
|
|||||||
while (getline(stream, token, '&') != 0) {
|
while (getline(stream, token, '&') != 0) {
|
||||||
pos = token.find('=');
|
pos = token.find('=');
|
||||||
if (pos != string::npos) {
|
if (pos != string::npos) {
|
||||||
const char* qname = query.substr(0, pos).c_str();
|
string qname = token.substr(0, pos);
|
||||||
const char* value = query.substr(pos+1).c_str();
|
string value = token.substr(pos+1);
|
||||||
if (strcmp(qname, "since") == 0) {
|
if (strcmp(qname.c_str(), "since") == 0) {
|
||||||
since = parseInt(value, 10, 0, 0xffffffff, ret);
|
since = parseInt(value.c_str(), 10, 0, 0xffffffff, ret);
|
||||||
if (ret != RESULT_OK)
|
} else if (strcmp(qname.c_str(), "poll") == 0) {
|
||||||
break;
|
pollPriority = (unsigned char)parseInt(value.c_str(), 10, 1, 9, ret);
|
||||||
} else if (strcmp(qname, "poll") == 0) {
|
} else if (strcmp(qname.c_str(), "exact") == 0) {
|
||||||
pollPriority = (unsigned char)parseInt(value, 10, 1, 9, ret);
|
exact = value.length()==0 || strcmp(value.c_str(), "1") == 0;
|
||||||
|
}
|
||||||
if (ret != RESULT_OK)
|
if (ret != RESULT_OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
deque<Message*> messages = m_messages->findAll(clazz, name, -1, exact, true, false, true);
|
||||||
deque<Message*> messages = m_messages->findAll(clazz, name, -1, false, true, false, true);
|
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
result << "{";
|
result << "{";
|
||||||
|
|||||||
Reference in New Issue
Block a user