]> mj.ucw.cz Git - libucw.git/commitdiff
Misc.
authorMartin Mares <mj@ucw.cz>
Fri, 9 May 1997 17:43:01 +0000 (17:43 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 9 May 1997 17:43:01 +0000 (17:43 +0000)
lib/url.c

index 91b53efe2eb664f6b691ebedde5198cb399d6d46..379e19a9defbbdbae24d3c60ba3c40de0f2a96c5 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -56,7 +56,7 @@ url_deescape(byte *s, byte *d)
          *d++ = val;
          s += 3;
        }
-      else if (*s >= 0x20 && *s <= 0x7e)
+      else if (*s >= 0x20 && *s <= 0x7e || *s >= 0xa0)
        *d++ = *s++;
       else
        return URL_ERR_INVALID_CHAR;
@@ -154,10 +154,13 @@ url_split(byte *s, struct url *u, byte *d)
          e = strchr(w, ':');
          if (e)                        /* host:port present */
            {
+             uns p;
              *e++ = 0;
-             u->port = strtoul(e, &ep, 10);
-             if (ep && *ep || u->port > 65535 || !u->port)
+             p = strtoul(e, &ep, 10);
+             if (ep && *ep || p > 65535)
                return URL_ERR_INVALID_PORT;
+             else if (p)               /* Port 0 (e.g. in :/) is treated as default port */
+               u->port = p;
            }
          u->host = w;
        }