From a7b8b16a4ce8167cf4e19d1b2515034c5712dd3f Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 9 May 1997 17:43:01 +0000 Subject: [PATCH] Misc. --- lib/url.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/url.c b/lib/url.c index 91b53efe..379e19a9 100644 --- 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; } -- 2.39.2