Skip to content

Commit c58b005

Browse files
authored
reserving before encoding (yhirose#912)
1 parent 7c60e69 commit c58b005

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

httplib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,8 @@ inline std::string encode_query_param(const std::string &value) {
16121612

16131613
inline std::string encode_url(const std::string &s) {
16141614
std::string result;
1615-
1615+
result.reserve(s.size());
1616+
16161617
for (size_t i = 0; s[i]; i++) {
16171618
switch (s[i]) {
16181619
case ' ': result += "%20"; break;

0 commit comments

Comments
 (0)