Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try encode web seed redirect location #7640

Merged
merged 2 commits into from
May 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/web_peer_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ void web_peer_connection::handle_redirect(int const bytes_left)
file_index_t const file_index = m_file_requests.front().file_index;

location = aux::resolve_redirect_location(m_url, location);
location = maybe_url_encode(location);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be a comment here explaining that this is a work-around for buggy HTTP servers, that fail to encode the redirect URL.

#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "LOCATION", "%s", location.c_str());
#endif
Expand Down Expand Up @@ -735,6 +736,7 @@ void web_peer_connection::handle_redirect(int const bytes_left)
else
{
location = aux::resolve_redirect_location(m_url, location);
location = maybe_url_encode(location);
#ifndef TORRENT_DISABLE_LOGGING
peer_log(peer_log_alert::info, "LOCATION", "%s", location.c_str());
#endif
Expand Down