diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-03-17 14:18:52 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-03-17 14:18:52 +0000 |
| commit | 08a49957b3f06926744987207d542efa2631394d (patch) | |
| tree | 2b20a72252d0cf0e939f01dff9e9694a5fafe4c5 /lib/libfetch/fetch.c | |
| parent | ff17a6773e4785a8fb78c540de32a208c43162db (diff) | |
Notes
Diffstat (limited to 'lib/libfetch/fetch.c')
| -rw-r--r-- | lib/libfetch/fetch.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c index dd6b98f04bbd..f2510831c00c 100644 --- a/lib/libfetch/fetch.c +++ b/lib/libfetch/fetch.c @@ -386,18 +386,17 @@ fetchParseURL(const char *URL) } /* hostname */ -#ifdef INET6 if (*p == '[' && (q = strchr(p + 1, ']')) != NULL && (*++q == '\0' || *q == '/' || *q == ':')) { - if ((i = q - p - 2) > MAXHOSTNAMELEN) + if ((i = q - p) > MAXHOSTNAMELEN) i = MAXHOSTNAMELEN; - strncpy(u->host, ++p, i); + strncpy(u->host, p, i); p = q; - } else -#endif + } else { for (i = 0; *p && (*p != '/') && (*p != ':'); p++) if (i < MAXHOSTNAMELEN) u->host[i++] = *p; + } /* port */ if (*p == ':') { @@ -444,12 +443,12 @@ nohost: } DEBUG(fprintf(stderr, - "scheme: [%s]\n" - "user: [%s]\n" - "password: [%s]\n" - "host: [%s]\n" - "port: [%d]\n" - "document: [%s]\n", + "scheme: \"%s\"\n" + "user: \"%s\"\n" + "password: \"%s\"\n" + "host: \"%s\"\n" + "port: \"%d\"\n" + "document: \"%s\"\n", u->scheme, u->user, u->pwd, u->host, u->port, u->doc)); |
