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 | |
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')
-rw-r--r-- | src/uscxml/Factory.h | 4 | ||||
-rw-r--r-- | src/uscxml/server/HTTPServer.cpp | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/uscxml/Factory.h b/src/uscxml/Factory.h index 617e461..d4c7601 100644 --- a/src/uscxml/Factory.h +++ b/src/uscxml/Factory.h @@ -302,6 +302,10 @@ public: return *this; } + virtual std::set<std::string> getNames() { + return _impl->getNames(); + } + virtual bool validate(const std::string& location, const std::string& schema) { return _impl->validate(location, schema); } 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); |