Release redbean 2.0.18

This commit is contained in:
Justine Tunney 2022-09-04 06:57:59 -07:00
parent 8dd4ec68d0
commit 6a04bc3318
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
4 changed files with 16 additions and 16 deletions

View file

@ -103,12 +103,10 @@ static const char *Str(int rc, const char *s) {
* Asks kernel to give us `uname -a` data. * Asks kernel to give us `uname -a` data.
* *
* - `machine` should be one of: * - `machine` should be one of:
*
* - `x86_64` * - `x86_64`
* - `amd64` * - `amd64`
* *
* - `sysname` should be one of: * - `sysname` should be one of:
*
* - `Linux` * - `Linux`
* - `FreeBSD` * - `FreeBSD`
* - `NetBSD` * - `NetBSD`

View file

@ -132,11 +132,6 @@ char *EscapeJsStringLiteral(char **r, size_t *y, const char *p, size_t n,
q[1] = '"'; q[1] = '"';
q += 2; q += 2;
break; break;
case 8:
q[0] = '\\';
q[1] = '\'';
q += 2;
break;
case 9: case 9:
w = EncodeUtf16(x); w = EncodeUtf16(x);
do { do {

View file

@ -17,13 +17,16 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/calls/calls.h" #include "libc/calls/calls.h"
#include "libc/log/check.h"
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h" #include "libc/runtime/gc.internal.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/stdio/temp.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/testlib/ezbench.h" #include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h" #include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
#include "libc/x/x.h"
#include "net/http/escape.h" #include "net/http/escape.h"
char *o; char *o;
@ -69,7 +72,7 @@ void makefile1(void) {
char *p; char *p;
size_t n; size_t n;
p = EscapeJsStringLiteral(&o, &y, kHyperion, kHyperionSize, &n); p = EscapeJsStringLiteral(&o, &y, kHyperion, kHyperionSize, &n);
f = fopen("/tmp/a", "wb"); f = tmpfile();
fwrite(p, n, 1, f); fwrite(p, n, 1, f);
fclose(f); fclose(f);
} }
@ -79,7 +82,7 @@ void makefile2(void) {
char *p; char *p;
size_t n; size_t n;
p = EscapeJsStringLiteral(&o, &y, kHyperion, kHyperionSize, &n); p = EscapeJsStringLiteral(&o, &y, kHyperion, kHyperionSize, &n);
fd = creat("/tmp/a", 0644); fd = tmpfd();
write(fd, p, n); write(fd, p, n);
close(fd); close(fd);
} }

View file

@ -152,7 +152,7 @@ STATIC_YOINK("ShowCrashReportsEarly");
#define REDBEAN "redbean" #define REDBEAN "redbean"
#endif #endif
#define VERSION 0x020011 #define VERSION 0x020012
#define HASH_LOAD_FACTOR /* 1. / */ 4 #define HASH_LOAD_FACTOR /* 1. / */ 4
#define MONITOR_MICROS 150000 #define MONITOR_MICROS 150000
#define READ(F, P, N) readv(F, &(struct iovec){P, N}, 1) #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) { static int LuaGetResponseBody(lua_State *L) {
char *s = ""; char *s = "";
// response can be gzipped (>0), text (=0), or generator (<0) // response can be gzipped (>0), text (=0), or generator (<0)
int size = cpm.gzipped > 0 ? cpm.gzipped // original size int size = cpm.gzipped > 0 ? cpm.gzipped // original size
: cpm.gzipped == 0 ? cpm.contentlength : 0; : cpm.gzipped == 0 ? cpm.contentlength
: 0;
OnlyCallDuringRequest(L, "GetResponseBody"); OnlyCallDuringRequest(L, "GetResponseBody");
if (cpm.gzipped > 0 && if (cpm.gzipped > 0 &&
(!(s = FreeLater(malloc(cpm.gzipped))) || (!(s = FreeLater(malloc(cpm.gzipped))) ||
!Inflate(s, cpm.gzipped, cpm.content, cpm.contentlength))) { !Inflate(s, cpm.gzipped, cpm.content, cpm.contentlength))) {
return LuaNilError(L, "failed to decompress response"); return LuaNilError(L, "failed to decompress response");
} }
lua_pushlstring(L, cpm.gzipped > 0 ? s // return decompressed lua_pushlstring(L,
: cpm.gzipped == 0 ? cpm.content : "", size); cpm.gzipped > 0 ? s // return decompressed
: cpm.gzipped == 0 ? cpm.content
: "",
size);
return 1; return 1;
} }