diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-02-25 03:21:09 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-02-25 03:21:09 +0100 |
commit | e1dcd2beb412a3e77b5c6df23571135137b486ed (patch) | |
tree | 8b6f27dfe5b80778f34611f02c23a44e967f5802 | |
parent | 05227960c6fd55dc8b050bf83e71f0924bfaf257 (diff) |
webfs: properly handle %.*s in url path and debug prints
-rw-r--r-- | sys/src/cmd/webfs/http.c | 6 | ||||
-rw-r--r-- | sys/src/cmd/webfs/url.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/src/cmd/webfs/http.c b/sys/src/cmd/webfs/http.c index c279aeafe..907035bcc 100644 --- a/sys/src/cmd/webfs/http.c +++ b/sys/src/cmd/webfs/http.c @@ -663,7 +663,7 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost) for(;;){ if(n >= sizeof(buf)-2){ if(debug) - fprint(2, "-> %.*s", n, buf); + fprint(2, "-> %.*s", utfnlen(buf, n), buf); if(hwrite(h, buf, n) != n) goto Badflush; n = 0; @@ -685,7 +685,7 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost) continue; if(n > 0){ if(debug) - fprint(2, "-> %.*s", n, buf); + fprint(2, "-> %.*s", utfnlen(buf, n), buf); if(hwrite(h, buf, n) != n) goto Badflush; } @@ -693,7 +693,7 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost) } n += snprint(buf+n, sizeof(buf)-n, "\r\n"); if(debug) - fprint(2, "-> %.*s", n, buf); + fprint(2, "-> %.*s", utfnlen(buf, n), buf); if(hwrite(h, buf, n) != n){ Badflush: alarm(0); diff --git a/sys/src/cmd/webfs/url.c b/sys/src/cmd/webfs/url.c index 5d0a4c44b..1f460a8cb 100644 --- a/sys/src/cmd/webfs/url.c +++ b/sys/src/cmd/webfs/url.c @@ -169,7 +169,7 @@ abspath(char *s, char *b) return estrdup(b); if(*s != '/' && (x = strrchr(b, '/'))){ a = emalloc((x - b) + strlen(s) + 4); - sprint(a, "%.*s/%s", (int)(x - b), b, s); + sprint(a, "%.*s/%s", utfnlen(b, x - b), b, s); return remdot(a); } } |