diff --git a/lib/src/HttpRequestImpl.h b/lib/src/HttpRequestImpl.h index 95ae3d84..412aecf9 100644 --- a/lib/src/HttpRequestImpl.h +++ b/lib/src/HttpRequestImpl.h @@ -209,9 +209,7 @@ class HttpRequestImpl : public HttpRequest const std::string &getOriginalPath() const override { - return originalPath_.empty() - ? (originalPath_ = drogon::utils::urlEncode(path_)) - : originalPath_; + return originalPath_.empty() ? path_ : originalPath_; } void setQuery(const char *start, const char *end) @@ -675,7 +673,10 @@ class HttpRequestImpl : public HttpRequest HttpMethod previousMethod_{Invalid}; Version version_{Version::kUnknown}; std::string path_; - mutable std::string originalPath_; + /// Contains the encoded `path_` if and only if `path_` is set in encoded + /// form. If path is in a normal form and needed no decoding, then this will + /// be empty, as we do not need to store a duplicate. + std::string originalPath_; bool pathEncode_{true}; std::string_view matchedPathPattern_{""}; std::string query_;