diff options
Diffstat (limited to 'src/netbase.cpp')
| -rw-r--r-- | src/netbase.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp index ebf823e89..2131bdf75 100644 --- a/src/netbase.cpp +++ b/src/netbase.cpp @@ -11,6 +11,7 @@ #endif #include "strlcpy.h" +#include <boost/algorithm/string/case_conv.hpp> // for to_lower() using namespace std; @@ -27,6 +28,7 @@ static bool vfNoProxy[NET_MAX] = {}; static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; enum Network ParseNetwork(std::string net) { + boost::to_lower(net); if (net == "ipv4") return NET_IPV4; if (net == "ipv6") return NET_IPV6; if (net == "tor") return NET_TOR; @@ -464,12 +466,14 @@ bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest int port = portDefault; size_t colon = strDest.find_last_of(':'); - char *endp = NULL; - int n = strtol(pszDest + colon + 1, &endp, 10); - if (endp && *endp == 0 && n >= 0) { - strDest = strDest.substr(0, colon); - if (n > 0 && n < 0x10000) - port = n; + if (colon != strDest.npos) { + char *endp = NULL; + int n = strtol(pszDest + colon + 1, &endp, 10); + if (endp && *endp == 0 && n >= 0) { + strDest = strDest.substr(0, colon); + if (n > 0 && n < 0x10000) + port = n; + } } if (strDest[0] == '[' && strDest[strDest.size()-1] == ']') strDest = strDest.substr(1, strDest.size()-2); |