diff --git a/src/lib/utils/httpclient.cpp b/src/lib/utils/httpclient.cpp index c3b0bfee..99354ea6 100755 --- a/src/lib/utils/httpclient.cpp +++ b/src/lib/utils/httpclient.cpp @@ -20,7 +20,6 @@ #include #include #include -#include namespace ebusd { @@ -40,13 +39,18 @@ bool HttpClient::parseUrl(const string& url, string& proto, string& host, uint16 return false; } size_t pos = url.find('/', hostPos); - if (pos == string::npos || pos == hostPos) { + if (pos == hostPos) { return false; } - host = url.substr(hostPos, pos - hostPos); - uri = url.substr(pos); - if (uri[uri.length()-1] != '/') { - uri += "/"; + if (pos == string::npos) { + host = url.substr(hostPos); + uri = "/"; + } else { + host = url.substr(hostPos, pos - hostPos); + uri = url.substr(pos); + if (uri[uri.length()-1] != '/') { + uri += "/"; + } } pos = host.find(':'); if (pos == 0) {