Added URL encoding/decoding and proper POST parsing

Also fixed last body line being ignored in requests
This commit is contained in:
Fred Nicolson
2016-12-31 22:05:44 +00:00
parent e0e956cf78
commit 27b559b4ef
4 changed files with 106 additions and 15 deletions
+2 -2
View File
@@ -44,7 +44,7 @@ namespace fr
//Store the header
std::string header_name = lines[a].substr(0, colon_iter);
std::string header_content = lines[a].substr(colon_iter + 2, lines[a].size () - colon_iter - 3);
std::string header_content = url_decode(lines[a].substr(colon_iter + 2, lines[a].size () - colon_iter - 3));
headers.emplace(header_name, header_content);
}
@@ -64,7 +64,7 @@ namespace fr
//Add the headers to the response
for(const auto &header : headers)
{
std::string data = header.first + ": " + header.second + "\r\n";
std::string data = header.first + ": " + url_encode(header.second) + "\r\n";
response += data;
}