summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-08-05 16:50:55 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-08-05 16:50:55 +0000
commit215c44558311d7a670cba91a264eb28628f78a5d (patch)
treefb34fcd48e5a6f3dbd67a0a2e4a208952fff8ee8 /lib
parent20d8e32a58b30c7d2bb96fdc2b9cb0aaae3866de (diff)
downloadcurl-215c44558311d7a670cba91a264eb28628f78a5d.tar.gz
re-added the RFC2732-parser that was lost for some reason during the flow
of time!
Diffstat (limited to 'lib')
-rw-r--r--lib/url.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/url.c b/lib/url.c
index bbe28788d..f11d5df17 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1391,6 +1391,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
#ifdef HAVE_ALARM
unsigned int prev_alarm;
#endif
+ char endbracket;
#ifdef HAVE_SIGACTION
struct sigaction keep_sigact; /* store the old struct here */
@@ -1980,8 +1981,19 @@ static CURLcode CreateConnection(struct SessionHandle *data,
* The conn->name is currently [user:passwd@]host[:port] where host could
* be a hostname, IPv4 address or IPv6 address.
*************************************************************/
-
- tmp = strrchr(conn->name, ':');
+ if((1 == sscanf(conn->name, "[%*39[0-9a-fA-F:.]%c", &endbracket)) &&
+ (']' == endbracket)) {
+ /* this is a RFC2732-style specified IP-address */
+
+ conn->name++; /* pass the starting bracket */
+ tmp = strchr(conn->name, ']');
+ *tmp = 0; /* zero terminate */
+ tmp++; /* pass the ending bracket */
+ if(':' != *tmp)
+ tmp = NULL; /* no port number available */
+ }
+ else
+ tmp = strrchr(conn->name, ':');
if (tmp) {
char *rest;