(svn r15978) -Codechange: support parsing [] enclosed IPv6 addresses.

This commit is contained in:
rubidium
2009-04-08 01:22:57 +00:00
parent 20e82c46d3
commit a5a424ce28
2 changed files with 12 additions and 1 deletions

View File

@@ -374,14 +374,25 @@ static void CheckMinActiveClients()
* occupied by connection_string. */
void ParseConnectionString(const char **company, const char **port, char *connection_string)
{
bool ipv6 = false;
char *p;
for (p = connection_string; *p != '\0'; p++) {
switch (*p) {
case '[':
ipv6 = true;
break;
case ']':
ipv6 = false;
break;
case '#':
*company = p + 1;
*p = '\0';
break;
case ':':
if (ipv6) break;
*port = p + 1;
*p = '\0';
break;