Commit b3bc387e authored by legoc's avatar legoc

Changed implementation of hostname()

parent 74903446
......@@ -22,7 +22,7 @@ using namespace std;
namespace core {
std::string hostname(const std::string endpoint) {
std::string hostname(const std::string endpoint, bool displayPort) {
string::size_type pos1 = endpoint.find_first_of(':');
......@@ -30,6 +30,10 @@ std::string hostname(const std::string endpoint) {
return "?";
}
if (displayPort) {
return endpoint.substr(pos1 + 3);
}
string::size_type pos2 = endpoint.find_first_of(':', pos1 + 1);
if (pos2 == string::npos) {
......
......@@ -26,7 +26,7 @@ namespace core {
/**
* Extracts the hostname from the endpoint.
*/
std::string hostname(const std::string endpoint);
std::string hostname(const std::string endpoint, bool displayPort = true);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment