Skip to content

Commit 9db1e5f

Browse files
committed
Prevent re-encoding of redirection paths
1 parent ca5fe35 commit 9db1e5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

httplib.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8661,10 +8661,11 @@ inline bool ClientImpl::redirect(Request &req, Response &res, Error &error) {
86618661
if (next_host.empty()) { next_host = host_; }
86628662
if (next_path.empty()) { next_path = "/"; }
86638663

8664-
auto path = detail::decode_path(next_path, true) + next_query;
8664+
auto path = next_path + next_query;
86658665

86668666
// Same host redirect - use current client
86678667
if (next_scheme == scheme && next_host == host_ && next_port == port_) {
8668+
this->set_path_encode(false); //Disable path encoding, redirects should already be encoded
86688669
return detail::redirect(*this, req, res, path, location, error);
86698670
}
86708671

@@ -8756,7 +8757,7 @@ inline void ClientImpl::setup_redirect_client(ClientType &client) {
87568757
client.set_keep_alive(keep_alive_);
87578758
client.set_follow_location(
87588759
true); // Enable redirects to handle multi-step redirects
8759-
client.set_path_encode(path_encode_);
8760+
client.set_path_encode(false); //Disable encoding, redirects should already be encoded
87608761
client.set_compress(compress_);
87618762
client.set_decompress(decompress_);
87628763

0 commit comments

Comments
 (0)