// declaration using 'unused' attribute because in some modules not all functions are used
static std::string fromChar(const char* c) __attribute__ ((unused));
static std::string clearURL(const std::string & url) __attribute__ ((unused));
+ static bool checkIfProtocolExist(const std::string & url) __attribute__ ((unused));
static std::string extractDomain(const std::string & url) __attribute__ ((unused));
static std::string fromChar(const char* c) { return c ? std::string(c) : std::string(); }
return url.substr(beg, url.size() - beg - suffix);
}
+ static bool checkIfProtocolExist(const std::string & url) {
+ return url.find(PROTCOL_BEGIN) != std::string::npos;
+ }
+
static std::string extractDomain(const std::string & url) {
size_t beg = url.find(PROTCOL_BEGIN);
beg += strlen(PROTCOL_BEGIN);
std::string url = urlArg;
std::string title = titleArg;
- if (!url.compare(0, tools::PROTOCOL_HTTP.length(), tools::PROTOCOL_HTTP))
+ if(!tools::checkIfProtocolExist(url))
url = std::string(tools::PROTOCOL_HTTP) + url;
if (titleArg.empty()) {