fixes bug report #547484, no_proxy doesn't properly strip off port numbers
authorDaniel Stenberg <daniel@haxx.se>
Tue, 23 Apr 2002 13:34:28 +0000 (13:34 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 23 Apr 2002 13:34:28 +0000 (13:34 +0000)
from the host names before comparing

lib/url.c

index fbe7afc..514cbd0 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -1611,9 +1611,16 @@ static CURLcode CreateConnection(struct SessionHandle *data,
 
       nope=no_proxy?strtok_r(no_proxy, ", ", &no_proxy_tok_buf):NULL;
       while(nope) {
-        if(strlen(nope) <= strlen(conn->name)) {
+        int namelen;
+        char *endptr = strchr(conn->name, ':');
+        if(endptr)
+          namelen=endptr-conn->name;
+        else
+          namelen=strlen(conn->name);
+
+        if(strlen(nope) <= namelen) {
           char *checkn=
-            conn->name + strlen(conn->name) - strlen(nope);
+            conn->name + namelen - strlen(nope);
           if(strnequal(nope, checkn, strlen(nope))) {
             /* no proxy for this host! */
             break;