mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-01 19:27:53 +08:00
Fix forwarding with space in url by encoding (#2155)
This commit is contained in:
parent
73406d1225
commit
93d8fb425d
@ -850,6 +850,7 @@ void HttpAppFrameworkImpl::forward(
|
||||
const std::string &hostString,
|
||||
double timeout)
|
||||
{
|
||||
req->setPath(req->getOriginalPath());
|
||||
if (hostString.empty())
|
||||
{
|
||||
HttpInternalForwardHelper::forward(req, std::move(callback));
|
||||
|
@ -209,7 +209,9 @@ class HttpRequestImpl : public HttpRequest
|
||||
|
||||
const std::string &getOriginalPath() const override
|
||||
{
|
||||
return originalPath_.empty() ? path_ : originalPath_;
|
||||
return originalPath_.empty()
|
||||
? (originalPath_ = drogon::utils::urlEncode(path_))
|
||||
: originalPath_;
|
||||
}
|
||||
|
||||
void setQuery(const char *start, const char *end)
|
||||
@ -673,7 +675,7 @@ class HttpRequestImpl : public HttpRequest
|
||||
HttpMethod previousMethod_{Invalid};
|
||||
Version version_{Version::kUnknown};
|
||||
std::string path_;
|
||||
std::string originalPath_;
|
||||
mutable std::string originalPath_;
|
||||
bool pathEncode_{true};
|
||||
std::string_view matchedPathPattern_{""};
|
||||
std::string query_;
|
||||
|
Loading…
Reference in New Issue
Block a user