diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-08 19:47:41 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-10-08 19:47:41 (GMT) |
commit | 525daee195c5593f077d837a689f2c5d26f91fb0 (patch) | |
tree | c440d0b75fae0d73cf28a5724909933c3d97420c /src/uscxml/server | |
parent | 9479a0d91c1bb9241324dea4f92b50405d17e97b (diff) | |
download | uscxml-525daee195c5593f077d837a689f2c5d26f91fb0.zip uscxml-525daee195c5593f077d837a689f2c5d26f91fb0.tar.gz uscxml-525daee195c5593f077d837a689f2c5d26f91fb0.tar.bz2 |
Fixed x-www-form-urlencoded post parsing
Diffstat (limited to 'src/uscxml/server')
-rw-r--r-- | src/uscxml/server/HTTPServer.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index 28b3ba4..58a614e 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -344,14 +344,15 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD std::string item; std::string key; std::string value; - while(std::getline(ss, item, '=')) { + while(std::getline(ss, item, '&')) { if (item.length() == 0) continue; - if (key.length() == 0) { - key = item; + size_t equalPos = item.find('='); + if (equalPos == std::string::npos) continue; - } - value = item; + + 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); |