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;
|
||||
continue;
|
||||
}
|
||||
if(x == '+')
|
||||
x = ' ';
|
||||
*w++ = x;
|
||||
}
|
||||
*w = 0;
|
||||
|
@ -94,11 +92,11 @@ Ufmt(Fmt *f)
|
|||
fmtprint(f, ":%s", u->port);
|
||||
}
|
||||
if(s = Upath(u))
|
||||
fmtprint(f, "%E", (Str2){s, "/:@"});
|
||||
fmtprint(f, "%E", (Str2){s, "/:@+"});
|
||||
if(u->query)
|
||||
fmtprint(f, "?%E", (Str2){u->query, "/:@"});
|
||||
if(u->fragment)
|
||||
fmtprint(f, "#%E", (Str2){u->fragment, "/:@?"});
|
||||
fmtprint(f, "#%E", (Str2){u->fragment, "/:@?+"});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -297,6 +295,11 @@ Out:
|
|||
free(s);
|
||||
free(t);
|
||||
|
||||
/* the + character encodes space only in query part */
|
||||
if(s = u->query)
|
||||
while(s = strchr(s, '+'))
|
||||
*s++ = ' ';
|
||||
|
||||
unescape(u->user, "");
|
||||
unescape(u->pass, "");
|
||||
unescape(u->path, "/");
|
||||
|
|
Loading…
Reference in a new issue