Add state assertions to redbean Lua APIs

Many of the API functions provided by redbean are only appropriate to
call in certain contexts, such as request handling or .init.lua, etc.
For example, Fetch can't be called from the global scope of .init.lua
because SSL hasn't been configured yet. Earlier if this happened then
redbean would crash, which was confusing. What we'll do now is show a
friendly error message. See #97

This change also undocuments redbean ssl compression support since it
seems to be causing a flake in the testing infrastructure.
This commit is contained in:
Justine Tunney 2021-08-09 14:45:52 -07:00
parent 3bfb7580c5
commit ee7e296339
7 changed files with 165 additions and 37 deletions

View file

@ -17,7 +17,9 @@ extern mbedtls_ssl_config ezconf;
extern mbedtls_ssl_context ezssl;
extern mbedtls_ctr_drbg_context ezrng;
void EzHandshake(void);
void SetupPresharedKeySsl(int);
void EzTlsDie(const char *, int) wontreturn;
int EzTlsFlush(struct EzTlsBio *, const unsigned char *, size_t);
COSMOPOLITAN_C_END_