From c58b00580ee66a248c2ef20334bb84319ccde310 Mon Sep 17 00:00:00 2001 From: Aswin Raj Kharel Date: Sat, 24 Apr 2021 15:19:14 -0500 Subject: [PATCH] reserving before encoding (#912) --- httplib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httplib.h b/httplib.h index a7a1973..fff0bc4 100644 --- a/httplib.h +++ b/httplib.h @@ -1612,7 +1612,8 @@ inline std::string encode_query_param(const std::string &value) { inline std::string encode_url(const std::string &s) { std::string result; - + result.reserve(s.size()); + for (size_t i = 0; s[i]; i++) { switch (s[i]) { case ' ': result += "%20"; break;