diff --git a/libc/calls/uname.c b/libc/calls/uname.c index e4e5d3660..22f052f00 100644 --- a/libc/calls/uname.c +++ b/libc/calls/uname.c @@ -103,12 +103,10 @@ static const char *Str(int rc, const char *s) { * Asks kernel to give us `uname -a` data. * * - `machine` should be one of: - * * - `x86_64` * - `amd64` * * - `sysname` should be one of: - * * - `Linux` * - `FreeBSD` * - `NetBSD` diff --git a/net/http/escapejsstringliteral.c b/net/http/escapejsstringliteral.c index 5d0355b3e..cd474fe7d 100644 --- a/net/http/escapejsstringliteral.c +++ b/net/http/escapejsstringliteral.c @@ -132,11 +132,6 @@ char *EscapeJsStringLiteral(char **r, size_t *y, const char *p, size_t n, q[1] = '"'; q += 2; break; - case 8: - q[0] = '\\'; - q[1] = '\''; - q += 2; - break; case 9: w = EncodeUtf16(x); do { diff --git a/test/net/http/escapejsstringliteral_test.c b/test/net/http/escapejsstringliteral_test.c index a5586c97e..f3cbf611f 100644 --- a/test/net/http/escapejsstringliteral_test.c +++ b/test/net/http/escapejsstringliteral_test.c @@ -17,13 +17,16 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/calls/calls.h" +#include "libc/log/check.h" #include "libc/mem/mem.h" #include "libc/runtime/gc.internal.h" #include "libc/stdio/stdio.h" +#include "libc/stdio/temp.h" #include "libc/str/str.h" #include "libc/testlib/ezbench.h" #include "libc/testlib/hyperion.h" #include "libc/testlib/testlib.h" +#include "libc/x/x.h" #include "net/http/escape.h" char *o; @@ -69,7 +72,7 @@ void makefile1(void) { char *p; size_t n; p = EscapeJsStringLiteral(&o, &y, kHyperion, kHyperionSize, &n); - f = fopen("/tmp/a", "wb"); + f = tmpfile(); fwrite(p, n, 1, f); fclose(f); } @@ -79,7 +82,7 @@ void makefile2(void) { char *p; size_t n; p = EscapeJsStringLiteral(&o, &y, kHyperion, kHyperionSize, &n); - fd = creat("/tmp/a", 0644); + fd = tmpfd(); write(fd, p, n); close(fd); } diff --git a/tool/net/redbean.c b/tool/net/redbean.c index 344282886..afa9afd19 100644 --- a/tool/net/redbean.c +++ b/tool/net/redbean.c @@ -152,7 +152,7 @@ STATIC_YOINK("ShowCrashReportsEarly"); #define REDBEAN "redbean" #endif -#define VERSION 0x020011 +#define VERSION 0x020012 #define HASH_LOAD_FACTOR /* 1. / */ 4 #define MONITOR_MICROS 150000 #define READ(F, P, N) readv(F, &(struct iovec){P, N}, 1) @@ -3992,16 +3992,20 @@ static int LuaGetBody(lua_State *L) { static int LuaGetResponseBody(lua_State *L) { char *s = ""; // response can be gzipped (>0), text (=0), or generator (<0) - int size = cpm.gzipped > 0 ? cpm.gzipped // original size - : cpm.gzipped == 0 ? cpm.contentlength : 0; + int size = cpm.gzipped > 0 ? cpm.gzipped // original size + : cpm.gzipped == 0 ? cpm.contentlength + : 0; OnlyCallDuringRequest(L, "GetResponseBody"); if (cpm.gzipped > 0 && - (!(s = FreeLater(malloc(cpm.gzipped))) || - !Inflate(s, cpm.gzipped, cpm.content, cpm.contentlength))) { + (!(s = FreeLater(malloc(cpm.gzipped))) || + !Inflate(s, cpm.gzipped, cpm.content, cpm.contentlength))) { return LuaNilError(L, "failed to decompress response"); } - lua_pushlstring(L, cpm.gzipped > 0 ? s // return decompressed - : cpm.gzipped == 0 ? cpm.content : "", size); + lua_pushlstring(L, + cpm.gzipped > 0 ? s // return decompressed + : cpm.gzipped == 0 ? cpm.content + : "", + size); return 1; }