Skip to content

Commit

Permalink
[Cl] Also recognise IPv4 mapped addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
smithdh committed Feb 6, 2025
1 parent 768ff82 commit 0b7a39f
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/XrdCl/XrdClURL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,23 @@ namespace XrdCl
// Check if we're IPv6 encoded IPv4
//----------------------------------------------------------------------
pos = pHostName.find( "." );
size_t pos2 = pHostName.find( "[::ffff" );
size_t pos3 = pHostName.find( "[::" );
if( pos != std::string::npos && pos3 != std::string::npos &&
pos2 == std::string::npos )
const size_t pos2 = pHostName.find( "[::" );
if( pos != std::string::npos && pos2 != std::string::npos )
{
pHostName.erase( 0, 3 );
pHostName.erase( pHostName.length()-1, 1 );
std::string hlower = pHostName;
std::transform(hlower.begin(), hlower.end(), hlower.begin(),
[](unsigned char c){ return std::tolower(c); });
const size_t pos3 = hlower.find( "[::ffff:" );
if ( pos3 != std::string::npos )
{
pHostName.erase( 0, 8 );
pHostName.erase( pHostName.length()-1, 1 );
}
else
{
pHostName.erase( 0, 3 );
pHostName.erase( pHostName.length()-1, 1 );
}
}
}
}
Expand Down

0 comments on commit 0b7a39f

Please sign in to comment.