aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaeseung Ha <ipknhama@gmail.com>2014-11-09 08:10:51 +0900
committerJaeseung Ha <ipknhama@gmail.com>2014-11-09 08:20:04 +0900
commit11128435cd10d0c95bebdd513a42a8dcaacf8230 (patch)
treea11bdeae348f834b363f5b598d839e32c6fd43d6
parent3ec459e477848e9eadd1712e9d8877f4bd79ad9c (diff)
downloadcrow-11128435cd10d0c95bebdd513a42a8dcaacf8230.tar.gz
crow-11128435cd10d0c95bebdd513a42a8dcaacf8230.zip
fix query_string bug that crashed test
-rw-r--r--include/query_string.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/query_string.h b/include/query_string.h
index d0a93ea..86c99cc 100644
--- a/include/query_string.h
+++ b/include/query_string.h
@@ -245,6 +245,39 @@ namespace crow
}
+ query_string(const query_string& qs)
+ : url_(qs.url_)
+ {
+ for(auto p:qs.key_value_pairs_)
+ {
+ key_value_pairs_.push_back((char*)(p-qs.url_.c_str()+url_.c_str()));
+ }
+ }
+
+ query_string& operator = (const query_string& qs)
+ {
+ url_ = qs.url_;
+ key_value_pairs_.clear();
+ for(auto p:qs.key_value_pairs_)
+ {
+ key_value_pairs_.push_back((char*)(p-qs.url_.c_str()+url_.c_str()));
+ }
+ return *this;
+ }
+
+ query_string& operator = (query_string&& qs)
+ {
+ key_value_pairs_ = std::move(qs.key_value_pairs_);
+ char* old_data = (char*)qs.url_.c_str();
+ url_ = std::move(qs.url_);
+ for(auto& p:key_value_pairs_)
+ {
+ p += (char*)url_.c_str() - old_data;
+ }
+ return *this;
+ }
+
+
query_string(std::string url)
: url_(std::move(url))
{