- case 0:
- // Protocol
- if (part[part.length()-1] != ':')
- return false;
- url.protocol = part.substr(0, part.length() - 1);
- break;
- case 1:
- // Empty, skip
- break;
- case 2:
- // User and password (user:pass@)
- string::size_type aend = part.find('@', 0);
- if (aend != string::npos)
+ // Protocol ('http:')
+ url.protocol = part.substr(0, part.length() - 1);
+ }
+ else if ((p == 1) && (part.empty()))
+ {
+ continue;
+ }
+ else if (url.domain.empty())
+ {
+ // Domain part: [user[:pass]@]domain[:port]
+ std::string::size_type usrpos = part.find('@');
+ if (usrpos != std::string::npos)
+ {
+ // Have a user (and possibly password) part
+ std::string::size_type ppos = part.find(':');
+ if ((ppos != std::string::npos) && (ppos < usrpos))