|
26 | 26 | #include "XrdCl/XrdClOptimizers.hh" |
27 | 27 |
|
28 | 28 | #include <cstdlib> |
| 29 | +#include <cctype> |
29 | 30 | #include <vector> |
30 | 31 | #include <sstream> |
31 | 32 | #include <algorithm> |
@@ -238,13 +239,23 @@ namespace XrdCl |
238 | 239 | // Check if we're IPv6 encoded IPv4 |
239 | 240 | //---------------------------------------------------------------------- |
240 | 241 | pos = pHostName.find( "." ); |
241 | | - size_t pos2 = pHostName.find( "[::ffff" ); |
242 | | - size_t pos3 = pHostName.find( "[::" ); |
243 | | - if( pos != std::string::npos && pos3 != std::string::npos && |
244 | | - pos2 == std::string::npos ) |
| 242 | + const size_t pos2 = pHostName.find( "[::" ); |
| 243 | + if( pos != std::string::npos && pos2 != std::string::npos ) |
245 | 244 | { |
246 | | - pHostName.erase( 0, 3 ); |
247 | | - pHostName.erase( pHostName.length()-1, 1 ); |
| 245 | + std::string hl = pHostName; |
| 246 | + std::transform(hl.begin(), hl.end(), hl.begin(), |
| 247 | + [](unsigned char c){ return std::tolower(c); }); |
| 248 | + const size_t pos3 = hl.find( "[::ffff:" ); |
| 249 | + if ( pos3 != std::string::npos ) |
| 250 | + { |
| 251 | + pHostName.erase( 0, 8 ); |
| 252 | + pHostName.erase( pHostName.length()-1, 1 ); |
| 253 | + } |
| 254 | + else |
| 255 | + { |
| 256 | + pHostName.erase( 0, 3 ); |
| 257 | + pHostName.erase( pHostName.length()-1, 1 ); |
| 258 | + } |
248 | 259 | } |
249 | 260 | } |
250 | 261 | } |
|
0 commit comments