webfs: fix broken handling of + character in urls
This commit is contained in:
parent
b70a7fc963
commit
1c521567a1
1 changed files with 7 additions and 4 deletions
|
@ -41,8 +41,6 @@ unescape(char *s, char *spec)
|
||||||
r += 2;
|
r += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(x == '+')
|
|
||||||
x = ' ';
|
|
||||||
*w++ = x;
|
*w++ = x;
|
||||||
}
|
}
|
||||||
*w = 0;
|
*w = 0;
|
||||||
|
@ -94,11 +92,11 @@ Ufmt(Fmt *f)
|
||||||
fmtprint(f, ":%s", u->port);
|
fmtprint(f, ":%s", u->port);
|
||||||
}
|
}
|
||||||
if(s = Upath(u))
|
if(s = Upath(u))
|
||||||
fmtprint(f, "%E", (Str2){s, "/:@"});
|
fmtprint(f, "%E", (Str2){s, "/:@+"});
|
||||||
if(u->query)
|
if(u->query)
|
||||||
fmtprint(f, "?%E", (Str2){u->query, "/:@"});
|
fmtprint(f, "?%E", (Str2){u->query, "/:@"});
|
||||||
if(u->fragment)
|
if(u->fragment)
|
||||||
fmtprint(f, "#%E", (Str2){u->fragment, "/:@?"});
|
fmtprint(f, "#%E", (Str2){u->fragment, "/:@?+"});
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,6 +295,11 @@ Out:
|
||||||
free(s);
|
free(s);
|
||||||
free(t);
|
free(t);
|
||||||
|
|
||||||
|
/* the + character encodes space only in query part */
|
||||||
|
if(s = u->query)
|
||||||
|
while(s = strchr(s, '+'))
|
||||||
|
*s++ = ' ';
|
||||||
|
|
||||||
unescape(u->user, "");
|
unescape(u->user, "");
|
||||||
unescape(u->pass, "");
|
unescape(u->pass, "");
|
||||||
unescape(u->path, "/");
|
unescape(u->path, "/");
|
||||||
|
|
Loading…
Reference in a new issue