summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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";