From 1bf616d6532ac1896dbc2f1b81fdc1d0fcc70bc1 Mon Sep 17 00:00:00 2001
From: yhirose <yuji.hirose.bug@gmail.com>
Date: Thu, 26 Dec 2019 17:50:53 -0500
Subject: [PATCH] Fix #303

---
 httplib.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/httplib.h b/httplib.h
index 42b5b8b..6d3100f 100644
--- a/httplib.h
+++ b/httplib.h
@@ -1967,7 +1967,7 @@ inline std::string encode_url(const std::string &s) {
     case '\n': result += "%0A"; break;
     case '\'': result += "%27"; break;
     case ',': result += "%2C"; break;
-    case ':': result += "%3A"; break;
+    // case ':': result += "%3A"; break; // ok? probably...
     case ';': result += "%3B"; break;
     default:
       auto c = static_cast<uint8_t>(s[i]);
@@ -3666,13 +3666,7 @@ inline bool Client::write_request(Stream &strm, const Request &req,
   BufferStream bstrm;
 
   // Request line
-  const static std::regex re(
-      R"(^((?:[^:/?#]+://)?(?:[^/?#]*)?)?([^?#]*(?:\?[^#]*)?(?:#.*)?))");
-
-  std::smatch m;
-  if (!regex_match(req.path, m, re)) { return false; }
-
-  auto path = m[1].str() + detail::encode_url(m[2].str());
+  const auto& path = detail::encode_url(req.path);
 
   bstrm.write_format("%s %s HTTP/1.1\r\n", req.method.c_str(), path.c_str());