Skip to content

Commit

Permalink
HTTPMessage: HandleJumpService correct URI parsing
Browse files Browse the repository at this point in the history
Changes how HandleJumpService parses HTTP request headers to properly
search for the jump service address helper in the URI, instead of the path.

Referencing monero-project#812
  • Loading branch information
coneiric committed Feb 20, 2018
1 parent 84aa7d6 commit 50d3b28
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/proxy/http.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ bool HTTPMessage::HandleJumpService() {
// response?; research this
// TODO(anonimal): add support for remaining services /
// rewrite this function
std::size_t pos1 = m_Path.rfind(m_JumpService.at(0));
std::size_t pos2 = m_Path.rfind(m_JumpService.at(1));
std::size_t pos1 = m_URL.rfind(m_JumpService.at(0));
std::size_t pos2 = m_URL.rfind(m_JumpService.at(1));
std::size_t pos;
if (pos1 == std::string::npos) {
if (pos2 == std::string::npos)
Expand All @@ -411,7 +411,7 @@ bool HTTPMessage::HandleJumpService() {
else
pos = pos2;
}
auto base64 = m_Path.substr(pos + m_JumpService.at(0).size());
auto base64 = m_URL.substr(pos + m_JumpService.at(0).size());
// We must decode
base64 = boost::network::uri::decoded(base64);
// Insert into address book
Expand All @@ -424,7 +424,7 @@ bool HTTPMessage::HandleJumpService() {
// We *could* redirect the user again to avoid dirtiness in the browser
kovri::client::context.GetAddressBook().InsertAddressIntoStorage(
m_Address, base64);
m_Path.erase(pos);
m_URL.erase(pos);
return true;
}

Expand Down

0 comments on commit 50d3b28

Please sign in to comment.