Skip to content

Commit

Permalink
add uri::is_local()
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-f committed Jun 21, 2016
1 parent dd4a665 commit adcfd70
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions userspace/libsinsp/uri.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class uri
std::string get_credentials() const;

std::string to_string(bool show_creds = true) const;
bool is_local() const;

// URI-encodes the given string by escaping reserved, ambiguous and non-ASCII
// characters. Returns the encoded string with uppercase hex letters (eg. %5B, not %5b).
Expand Down Expand Up @@ -112,3 +113,8 @@ inline std::string uri::get_credentials() const
}
return creds;
}

inline bool uri::is_local() const
{
return m_host == "localhost" || m_host == "127.0.0.1" || m_scheme == "file";
}

0 comments on commit adcfd70

Please sign in to comment.