* Fixed retrieving the port from IPv6 addresses; ie. we now support the
"[addr]:port" notation. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40449 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, Axel Dörfler, [email protected].
|
* Copyright 2010-2011, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -15,7 +15,12 @@
|
|||||||
static bool
|
static bool
|
||||||
strip_port(BString& host, BString& port)
|
strip_port(BString& host, BString& port)
|
||||||
{
|
{
|
||||||
int32 separator = host.FindFirst(':');
|
int32 first = host.FindFirst(':');
|
||||||
|
int32 separator = host.FindLast(':');
|
||||||
|
if (separator != first
|
||||||
|
&& (separator == 0 || host.ByteAt(separator - 1) != ']'))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (separator != -1) {
|
if (separator != -1) {
|
||||||
// looks like there is a port
|
// looks like there is a port
|
||||||
host.CopyInto(port, separator + 1, -1);
|
host.CopyInto(port, separator + 1, -1);
|
||||||
|
|||||||
Reference in New Issue
Block a user