ref: d30c1aec7c4269b1517c4bb02bedc0c27a3cf9b7
parent: 49fe9dbd591431cb4146d849ee11f17ad9df3e36
author: cinap_lenrek <cinap_lenrek@rei2.9hal>
date: Sat Jan 28 13:04:25 EST 2012
webfs: fix broken handling of + character in urls
--- a/sys/src/cmd/webfs/url.c
+++ b/sys/src/cmd/webfs/url.c
@@ -41,8 +41,6 @@
r += 2;
continue;
}
- if(x == '+')
- x = ' ';
*w++ = x;
}
*w = 0;
@@ -94,11 +92,11 @@
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;
}
@@ -296,6 +294,11 @@
pstrdup(&u->fragment);
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, "");
--
⑨