summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2009-10-24 14:28:17 +0000
committerStef Walter <stef@memberwebs.com>2009-10-24 14:28:17 +0000
commit97e97c0b6f86079d57e6bdf1190fa0555a53eb20 (patch)
tree810f8217c61c0c8b607854620da3dd4b39fe19e5 /common
parente3205e63314fa68426e83f1ffce6e8ac0e81e273 (diff)
Support bracketted addresses.
Diffstat (limited to 'common')
-rw-r--r--common/config-parser.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/common/config-parser.c b/common/config-parser.c
index 881838f..a76e9c2 100644
--- a/common/config-parser.c
+++ b/common/config-parser.c
@@ -375,6 +375,7 @@ const char*
cfg_parse_uri (char *uri, char** scheme, char** host, char **port,
char** user, char** path, char** query)
{
+ size_t len;
char* t;
*scheme = NULL;
@@ -392,7 +393,7 @@ cfg_parse_uri (char *uri, char** scheme, char** host, char **port,
*host = strsep(&uri, "/");
/* Parse the community out from the host */
- if(*host[0])
+ if((*host)[0])
{
t = strchr(*host, '@');
if(t)
@@ -404,7 +405,7 @@ cfg_parse_uri (char *uri, char** scheme, char** host, char **port,
}
/* Parse out the port from the uri */
- if(*host[0])
+ if((*host)[0])
{
t = strrchr(*host, ':');
if(t && looks_like_port(t + 1))
@@ -414,6 +415,14 @@ cfg_parse_uri (char *uri, char** scheme, char** host, char **port,
}
}
+ /* Remove any brackets from the host */
+ len = strlen (*host);
+ if(len > 2 && (*host)[0] == '[' && (*host)[len - 1] == ']')
+ {
+ (*host)[len - 1] = 0;
+ (*host)++;
+ }
+
if(!*host[0])
return "invalid uri: no host name found";