Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/Simple-WebSocket-Server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreidheim <eidheim@gmail.com>2020-08-31 14:19:06 +0300
committereidheim <eidheim@gmail.com>2020-08-31 14:19:06 +0300
commitdd8f88c7f782ca9e2bebe5d3d46cfcb17cef7bf4 (patch)
tree0465a959a958cdd66f56c27cd4ba4ccc715ab4e9
parenta7b227bdbed7ec2e74565772d63e61ae11106d56 (diff)
Updated utility.hpp
-rw-r--r--utility.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/utility.hpp b/utility.hpp
index 2c0e7cf..3b41ff3 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -145,13 +145,13 @@ namespace SimpleWeb {
name_end_pos = std::string::npos;
value_pos = std::string::npos;
}
- else if(query_string[c] == '=') {
+ else if(query_string[c] == '=' && name_end_pos == std::string::npos) {
name_end_pos = c;
value_pos = c + 1;
}
}
if(name_pos < query_string.size()) {
- auto name = query_string.substr(name_pos, name_end_pos - name_pos);
+ auto name = query_string.substr(name_pos, (name_end_pos == std::string::npos ? std::string::npos : name_end_pos - name_pos));
if(!name.empty()) {
auto value = value_pos >= query_string.size() ? std::string() : query_string.substr(value_pos);
result.emplace(std::move(name), Percent::decode(value));
@@ -260,7 +260,7 @@ namespace SimpleWeb {
std::size_t query_start = std::string::npos;
std::size_t path_and_query_string_end = std::string::npos;
for(std::size_t i = method_end + 1; i < line.size(); ++i) {
- if(line[i] == '?' && (i + 1) < line.size())
+ if(line[i] == '?' && (i + 1) < line.size() && query_start == std::string::npos)
query_start = i + 1;
else if(line[i] == ' ') {
path_and_query_string_end = i;