Skip to content

Commit

Permalink
HTTPMessage: HandleJumpService returns bool
Browse files Browse the repository at this point in the history
For testing and error handling, HTTPMessage::HandleJumpService returns
true on success, and false on failures.

Referencing monero-project#812
  • Loading branch information
coneiric committed Feb 20, 2018
1 parent d4673bf commit 7aa3945
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/client/proxy/http.cc
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ bool HTTPMessage::ExtractIncomingRequest() {
return true;
}

void HTTPMessage::HandleJumpService() {
bool HTTPMessage::HandleJumpService() {
// TODO(GUZZI) should have boolean return value; error
// response?; research this
// TODO(anonimal): add support for remaining services /
Expand All @@ -400,7 +400,7 @@ void HTTPMessage::HandleJumpService() {
std::size_t pos;
if (pos1 == std::string::npos) {
if (pos2 == std::string::npos)
return; // Not a jump service
return false; // Not a jump service
else
pos = pos2;
} else {
Expand All @@ -425,6 +425,7 @@ void HTTPMessage::HandleJumpService() {
kovri::client::context.GetAddressBook().InsertAddressIntoStorage(
m_Address, base64);
m_Path.erase(pos);
return true;
}

/* All hope is lost beyond this point */
Expand Down
4 changes: 2 additions & 2 deletions src/client/proxy/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ class HTTPMessage : public std::enable_shared_from_this<HTTPMessage>{
bool HandleData(const std::string &buf);

/// @brief Parses path for base64 address, inserts into address book
/// need to change to boolean return for testing
void HandleJumpService();
/// @return true on success
bool HandleJumpService();

/// @brief Performs regex, sets address/port/path, validates version
/// on request sent from user
Expand Down

0 comments on commit 7aa3945

Please sign in to comment.