From 49fee23e26cff90d6c1e0234be7216dbf4900e08 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 18 Apr 2005 19:55:58 +0000 Subject: Fixed getLocaleCharset() in Windows platform handler, when MLang is not present. --- src/utility/url.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/utility/url.cpp') diff --git a/src/utility/url.cpp b/src/utility/url.cpp index 0c0a5799..919a3610 100644 --- a/src/utility/url.cpp +++ b/src/utility/url.cpp @@ -181,12 +181,12 @@ void url::parse(const string& str) if (colonPos == string::npos) { - host = hostPart; + host = utility::stringUtils::trim(hostPart); } else { - host = string(hostPart.begin(), hostPart.begin() + colonPos); - port = string(hostPart.begin() + colonPos + 1, hostPart.end()); + host = utility::stringUtils::trim(string(hostPart.begin(), hostPart.begin() + colonPos)); + port = utility::stringUtils::trim(string(hostPart.begin() + colonPos + 1, hostPart.end())); } // Path @@ -198,8 +198,12 @@ void url::parse(const string& str) // Some sanity check if (proto.empty()) throw exceptions::malformed_url("No protocol specified"); - else if (host.empty() && path.empty()) // Accept empty host (eg. "file:///home/vincent/mydoc") - throw exceptions::malformed_url("No host specified"); + else if (host.empty()) + { + // Accept empty host (eg. "file:///home/vincent/mydoc") + if (proto != PROTOCOL_FILE) + throw exceptions::malformed_url("No host specified"); + } bool onlyDigit = true; @@ -217,6 +221,9 @@ void url::parse(const string& str) iss >> portNum; + if (portNum == 0) + portNum = UNSPECIFIED_PORT; + // Now, save URL parts m_protocol = proto; -- cgit