Don't add windows filesname to service list.
This commit is contained in:
@@ -122,6 +122,20 @@ AIPerService::AIPerService(AIPerService const&) : mHTTPBandwidth(0)
|
|||||||
// - userinfo does not contain a '@', and if it exists, is always terminated by a '@'.
|
// - userinfo does not contain a '@', and if it exists, is always terminated by a '@'.
|
||||||
// - port does not contain a ':', and if it exists is always prepended by a ':'.
|
// - port does not contain a ':', and if it exists is always prepended by a ':'.
|
||||||
//
|
//
|
||||||
|
// This function also needs to deal with full paths, in which case it should return
|
||||||
|
// an empty string.
|
||||||
|
//
|
||||||
|
// Full paths can have the form: "/something..."
|
||||||
|
// or "C:\something..."
|
||||||
|
// and maybe even "C:/something..."
|
||||||
|
//
|
||||||
|
// The first form leads to an empty string being returned because the '/' signals the
|
||||||
|
// end of the authority and we'll return immediately.
|
||||||
|
// The second one will abort when hitting the backslash because that is an illegal
|
||||||
|
// character in an url (before the first '/' anyway).
|
||||||
|
// The third will abort because "C:" would be the hostname and a colon in the hostname
|
||||||
|
// is not legal.
|
||||||
|
//
|
||||||
//static
|
//static
|
||||||
std::string AIPerService::extract_canonical_servicename(std::string const& url)
|
std::string AIPerService::extract_canonical_servicename(std::string const& url)
|
||||||
{
|
{
|
||||||
@@ -159,8 +173,13 @@ std::string AIPerService::extract_canonical_servicename(std::string const& url)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Found slash that is not part of the "sheme://" string. Signals end of authority.
|
// Found a slash that is not part of the "sheme://" string. Signals end of authority.
|
||||||
// We're done.
|
// We're done.
|
||||||
|
if (hostname < sheme_colon)
|
||||||
|
{
|
||||||
|
// This happens when windows filenames are passed to this function of the form "C:/..."
|
||||||
|
servicename.clear();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,6 +192,12 @@ std::string AIPerService::extract_canonical_servicename(std::string const& url)
|
|||||||
servicename.clear(); // Remove the "userinfo@"
|
servicename.clear(); // Remove the "userinfo@"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (c == '\\')
|
||||||
|
{
|
||||||
|
// Found a backslash, which is an illegal character for an URL. This is a windows path... reject it.
|
||||||
|
servicename.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (p >= hostname)
|
if (p >= hostname)
|
||||||
{
|
{
|
||||||
// Convert hostname to lowercase in a way that we compare two hostnames equal iff libcurl does.
|
// Convert hostname to lowercase in a way that we compare two hostnames equal iff libcurl does.
|
||||||
|
|||||||
Reference in New Issue
Block a user