summaryrefslogtreecommitdiffstats
path: root/lib/libfetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2000-12-01 11:04:57 +0000
committerdes <des@FreeBSD.org>2000-12-01 11:04:57 +0000
commit1d928c8e6ee0154bbda2d60abf2a69992c7ecb59 (patch)
treeb3ac981c0db7b1a230fc1a66a2d9475a12ca9e16 /lib/libfetch
parent91475759cebb15bdc491e2cf894f28c8064319fb (diff)
downloadFreeBSD-src-1d928c8e6ee0154bbda2d60abf2a69992c7ecb59.zip
FreeBSD-src-1d928c8e6ee0154bbda2d60abf2a69992c7ecb59.tar.gz
Clean up the whitespace encoding code.
Diffstat (limited to 'lib/libfetch')
-rw-r--r--lib/libfetch/fetch.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c
index 46da7ce..b26cad0 100644
--- a/lib/libfetch/fetch.c
+++ b/lib/libfetch/fetch.c
@@ -294,7 +294,7 @@ fetchMakeURL(char *scheme, char *host, int port, char *doc,
struct url *
fetchParseURL(char *URL)
{
- char *p, *q;
+ char *doc, *p, *q;
struct url *u;
int i;
@@ -367,15 +367,16 @@ nohost:
if (!*p)
p = "/";
- if (strcmp(u->scheme, "http") == 0 || strcmp(u->scheme, "https") == 0) {
+ if (strcasecmp(u->scheme, SCHEME_HTTP) == 0 ||
+ strcasecmp(u->scheme, SCHEME_HTTPS) == 0) {
const char hexnums[] = "0123456789abcdef";
- char *doc;
- /* Perform %hh encoding of white space. */
- if ((doc = u->doc = malloc(strlen(p) * 3 + 1)) == NULL) {
+ /* percent-escape whitespace. */
+ if ((doc = malloc(strlen(p) * 3 + 1)) == NULL) {
_fetch_syserr();
goto ouch;
}
+ u->doc = doc;
while (*p != '\0') {
if (!isspace(*p)) {
*doc++ = *p++;
OpenPOWER on IntegriCloud