Make more major improvements to redbean

- POSIX regular expressions for Lua
- Improved protocol parsing and encoding
- Additional APIs for ZIP storage retrieval
- Fix st_mode issue on NT for regular files
- Generalized APIs for URL and Host handling
- Worked out the kinks in resource resolution
- Allow for custom error pages like /404.html
This commit is contained in:
Justine Tunney 2021-04-20 19:14:21 -07:00
parent 26ac6871da
commit 4effa23528
74 changed files with 3710 additions and 14246 deletions

View file

@ -25,29 +25,29 @@
char *escapeparam(const char *s) {
struct EscapeResult r;
r = EscapeUrlParam(s, -1);
r = EscapeParam(s, -1);
ASSERT_EQ(strlen(r.data), r.size);
return r.data;
}
TEST(EscapeUrlParam, test) {
TEST(EscapeParam, test) {
EXPECT_STREQ("abc%20%26%3C%3E%22%27%01%02",
gc(escapeparam("abc &<>\"'\1\2")));
}
TEST(EscapeUrlParam, testLargeGrowth) {
TEST(EscapeParam, testLargeGrowth) {
EXPECT_STREQ("%22%22%22", gc(escapeparam("\"\"\"")));
}
TEST(EscapeUrlParam, testEmpty) {
TEST(EscapeParam, testEmpty) {
EXPECT_STREQ("", gc(escapeparam("")));
}
TEST(EscapeUrlParam, testAstralPlanes_usesUtf8HexEncoding) {
TEST(EscapeParam, testAstralPlanes_usesUtf8HexEncoding) {
EXPECT_STREQ("%F0%90%8C%B0", escapeparam("𐌰"));
}
BENCH(EscapeUrlParam, bench) {
EZBENCH2("EscapeUrlParam", donothing,
free(EscapeUrlParam(kHyperion, kHyperionSize).data));
BENCH(EscapeParam, bench) {
EZBENCH2("EscapeParam", donothing,
free(EscapeParam(kHyperion, kHyperionSize).data));
}