summaryrefslogtreecommitdiffstats
path: root/src/uscxml/server/HTTPServer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/server/HTTPServer.cpp')
-rw-r--r--src/uscxml/server/HTTPServer.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index 044cb6c..071846c 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -386,9 +386,14 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
key = item.substr(0, equalPos);
value = item.substr(equalPos + 1, item.length() - (equalPos + 1));
- char* keyCStr = evhttp_decode_uri(key.c_str());
- char* valueCStr = evhttp_decode_uri(value.c_str());
- request.data.compound["content"].compound[keyCStr] = Data(valueCStr, Data::VERBATIM);
+ size_t keyCStrLen = 0;
+ size_t valueCStrLen = 0;
+ char* keyCStr = evhttp_uridecode(key.c_str(), 1, &keyCStrLen);
+ char* valueCStr = evhttp_uridecode(value.c_str(), 1, &valueCStrLen);
+ std::string decKey = std::string(keyCStr, keyCStrLen);
+ std::string decValue = std::string(valueCStr, valueCStrLen);
+
+ request.data.compound["content"].compound[decKey] = Data(decValue, Data::VERBATIM);
free(keyCStr);
free(valueCStr);
key.clear();
@@ -412,6 +417,12 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD
request.raw = raw.str();
+#if 0
+ std::cout << "====" << std::endl;
+ std::cout << request.raw << std::endl;
+ std::cout << "====" << std::endl;
+#endif
+
// try with the handler registered for path first
bool answered = false;
if (callbackData != NULL)