Commit graph

569 commits

Author SHA1 Message Date
Justine Tunney
5022f9e920 Trim down redbean a little bit
This makes redbean.c a little less long. It also reduces the size of
redbean-original.com from being 333K to 213K.
2022-03-21 19:32:30 -07:00
Paul Kulchenko
87029ac3f9
Redbean stream yield implementation (#370)
* Simplify handling of coroutine state
* Update redbean to allow yielding from Lua to support streaming
* Add stack checks for Lua resume calls in redbean
2022-03-21 18:07:30 -07:00
Justine Tunney
e5314dedde Fix performance bottlenecks with nt fork redbean 2022-03-21 08:25:33 -07:00
Justine Tunney
d57f87dc40 Fix some issues with zipos and redbean
- redbean.com -D /zip/dir/ now works, for pure fun
- possibly fixed bug with redbean serving empty files
- zipos stat() mode now indicates directories on windows

See #372
2022-03-21 07:36:36 -07:00
Justine Tunney
4881ae7527 Update Argon2 for style
- Make sure notice licenses are embedded
- Remove copyright and docs from headers
2022-03-21 07:27:03 -07:00
Nick Owens
f78f2fcac3
redbean: allow symlinks for -D path (#372)
Previously ProgramDirectory called isdirectory which returns false for
symlinks. instead just check directory with stat, and allow user to pass
`-D /tmp/foo/`, where /tmp/foo might be a symlink.
2022-03-21 05:43:49 -07:00
Justine Tunney
5e8ae2d5bc Restart CI for New Technology and UBSAN hunting
Continuous Integration (via runit and runitd) is now re-enabled on win7
and win10. The `make test` command, which runs the tests on all systems
is now the fastest and most stable it's been since the project started.

UBSAN is now enabled in MODE=dbg in addition to ASAN. Many instances of
undefined behavior have been removed. Mostly things like passing a NULL
argument to memcpy(), which works fine with Cosmopolitan Libc, but that
doesn't prevents the compiler from being unhappy. There was an issue w/
GNU make where static analysis claims a sprintf() call can overflow. We
also now have nicer looking crash reports on Windows since uname should
now be supported and msys64 addr2line works reliably.
2022-03-21 04:32:57 -07:00
Paul Kulchenko
d5ff2c3fb9
Make improvements to redbean (#373)
* Allow ProgramUniprocess to be set on Windows
* Add closing p tag to Maxmind example
* Enable using symlinked directories with redbean -A flag
* Rename gc in redbean for consistency
* Improve StoreFile by adding checks and skipping ./ in stored path
* Add freeing memory in redbean LuaEncodeUrl

Ref #366
2022-03-21 03:20:09 -07:00
Justine Tunney
0cb6b6ff4b Get Redbean fork() working on the New Technology
Now that we have understandable system call tracing on Windows, this
change rewrites many of the polyfill internals for that platform, to
help things get closer to tip top shape. Support for complex forking
scenarios had been in a regressed state for quite some time. Now, it
works! Subsequent changes should be able to address the performance.
2022-03-20 08:01:14 -07:00
Paul Kulchenko
efedef6e65
Fix Lua EncodeUrl without values (#368) 2022-03-19 18:00:15 -07:00
Justine Tunney
39688a73e4 Polish recent changes and make improvements
- Simulate SIGPIPE on Windows NT
- Fix commandv() regression on Windows NT
- Fix sigprocmask() strace bug on OpenBSD
- Add many more system calls to --strace logging
- Make errno state more pristine in redbean strace
2022-03-19 03:37:00 -07:00
Justine Tunney
10a766ebd0 Delete VAX/OS2/DOS/AMIGA code from GNU Make 2022-03-18 21:39:44 -07:00
Justine Tunney
14e192e5ba Introduce --strace flag for system call tracing
This is similar to the --ftrace (c function call trace) flag, except
it's less noisy since it only logs system calls to stderr. Having this
flag is valuable because (1) system call tracing tells us a lot about
the behavior of complex programs and (2) it's usually very hard to get
system call tracing on various operating systems, e.g. strace, ktrace,
dtruss, truss, nttrace, etc. Especially on Apple platforms where even
with the special boot trick, debuggers still aren't guaranteed to work.

    make -j8 o//examples
    o//examples/hello.com --strace

This is enabled by default in MODE=, MODE=opt, and MODE=dbg. In MODE=dbg
extra information will be printed.

    make -j8 MODE=dbg o/dbg/examples
    o/dbg/examples/hello.com --strace |& less

This change also changes:

- Rename IsText() → _istext()
- Rename IsUtf8() → _isutf8()
- Fix madvise() on Windows NT
- Fix empty string case of inet_ntop()
- vfork() wrapper now saves and restores errno
- Update xsigaction() to yoink syscall support
2022-03-18 18:07:28 -07:00
Justine Tunney
c541225af0 Add maxmind demo to redbean-demo.com 2022-03-18 15:31:54 -07:00
Justine Tunney
c4d8f40422 Fix regression in kilo example 2022-03-18 14:30:45 -07:00
Justine Tunney
96bdd7e90f Update tzdata 2022-03-18 13:24:00 -07:00
Justine Tunney
390e22a8c6 Add ASAN guards to some asm data structures 2022-03-18 13:02:57 -07:00
Justine Tunney
6c2fd9ecc6 Clean old .source directive out of asm code 2022-03-18 12:43:21 -07:00
Justine Tunney
b149a9bcc4 Minor fixes for image printing programs 2022-03-18 04:20:10 -07:00
Justine Tunney
9d2c8798c1 Fix backtrace test failure in MODE=rel 2022-03-18 03:48:37 -07:00
Justine Tunney
d07a58a763 Fix inconsistency in SectorLambda license
SectorLambda is intended to be licensed ISC. SectorLambda is not
intended to be licensed under the TeX license.
2022-03-18 03:25:32 -07:00
Justine Tunney
c371db6663 Add maxmind to redbean 2022-03-18 03:17:08 -07:00
Justine Tunney
af645fcbec Make exciting improvements
- Add Lua backtraces to redbean!
- Wipe serving keys after redbean forks
- Audit redbean to remove free via exit
- Log SSL client ciphersuite preferences
- Increase ASAN malloc() backtrace depth
- Make GetSslRoots() behave as a singleton
- Move leaks.c from LIBC_TESTLIB to LIBC_LOG
- Add undocumented %n to printf() for newlines
- Fix redbean memory leak reindexing inode change
- Fix redbean memory leak with Fetch() DNS object
- Restore original environ after __cxa_finalize()
- Make backtrace always work after __cxa_finalize()
- Introduce COUNTEXPR() diagnostic / benchmark tool
- Fix a few more instances of errno being clobbered
- Consolidate the ANSI color disabling internal APIs
2022-03-18 03:02:00 -07:00
Justine Tunney
f5831a62fa Add SectorLambda 2022-03-17 14:12:41 -07:00
Justine Tunney
741c836e9d Fix build flags for kprintf() 2022-03-17 13:54:16 -07:00
Justine Tunney
46a3b88594 Have ASAN errors show origin of memory 2022-03-17 00:53:45 -07:00
Justine Tunney
e20fcf02c1 Fix redbean build flake 2022-03-16 17:37:24 -07:00
Justine Tunney
bf62140377 Choose better deterministic timestamp for zip 2022-03-16 16:59:45 -07:00
Justine Tunney
b45d50b690 Make improvements
- Fix build flakes
- Polyfill SIGWINCH on Windows
- Fix an execve issue on Windows
- Make strerror show more information
- Improve cmd.exe setup/teardown on Windows
- Support bracketed paste mode in Blinkenlights
- Show keyboard shortcuts in Blinkenlights status bar
- Fixed copy_file_range() and copyfile() w/ zip filesystem
- Size optimize GetDosArgv() to keep life.com 12kb in size
- Improve Blinkenlights ability to load weird ELF executables
- Fix program_executable_name and add GetInterpreterExecutableName
- Make Python in tiny mode fail better if docstrings are requested
- Update Python test exclusions in tiny* modes such as tinylinux
- Add bulletproof unbreakable kprintf() troubleshooting function
- Remove "oldskool" keyword from ape.S for virus scanners
- Fix issue that caused backtraces to not print sometimes
- Improve Blinkenlights serial uart character i/o
- Make clock_gettime() not clobber errno on xnu
- Improve sha256 cpuid check for old computers
- Integrate some bestline linenoise fixes
- Show runit process names better in htop
- Remove SIGPIPE from ShowCrashReports()
- Make realpath() not clobber errno
- Avoid attaching GDB on non-Linux
- Improve img.com example
2022-03-16 13:40:10 -07:00
Paul Kulchenko
2a938b3eaa
Use last X-Forwarded-For header (#367)
This header is non-standard but AWS seems to need this.
2022-03-14 17:21:15 -07:00
Paul Kulchenko
cfc557f7c7
Add storing folders in redbean from CLI (#366) 2022-03-14 17:19:31 -07:00
Paul Kulchenko
38112aeb20
Fix Redbean when file is read-only (#365) 2022-03-14 17:13:28 -07:00
Paul Kulchenko
22409b2b5e
Redbean SSL identification (#360)
* Let Fetch() be used earlier in initialization
* Have ssl log messages show cert name
* Introduce GetSslIdentity Lua API
2022-03-14 17:11:05 -07:00
Paul Kulchenko
abac6f729c
Add ProgramUniprocess to redbean (#364) 2022-03-07 18:15:44 -08:00
Paul Kulchenko
1e3c5e10ad
Update docs on chmod permissions (#336)
Closes #335
2022-03-07 18:13:49 -08:00
Paul Kulchenko
4abae20172
Redbean StoreAsset fix and lua cli (#326)
* Fix StoreAsset update for existing assets in redbean
* Add lua code execution and asset storage from redbean command line
2022-03-04 18:47:15 -08:00
Paul Kulchenko
9bab356c37
Fix double Content-Type after SetHeader (#327) 2022-03-04 18:44:39 -08:00
Paul Kulchenko
0f035119b1
Fix exec example (#341) 2022-03-04 17:51:32 -08:00
Paul Kulchenko
db6152e21d
Fix executable name generation under QEMU (#347)
Closes #346
2022-03-04 17:49:43 -08:00
Paul Kulchenko
d938b89f4f
Fix redbean browser launch before server starts (#359) 2022-03-04 17:41:19 -08:00
Justine Tunney
d6a039821f Release redbean 1.5 2021-11-15 07:39:38 -08:00
Oguz Bektas
f12c6c1b5e
Fix comment for nc example (#323)
The "Host" header is missing from the command for making the
request, so we get empty response.
2021-11-15 06:48:46 -08:00
Paul Kulchenko
fdb543cbb3
Fix incorrect reference in Lua encoding (#324) 2021-11-13 13:10:09 -08:00
Paul Kulchenko
1d6216a775
Add encode json and encode Lua functions to redbean (#322) 2021-11-13 12:49:29 -08:00
Jørgen Kvalsvik
206091617a
Don't pass unused args to printf (#311)
The final print does not print any content, only the byte-offset of the
end-block, which makes the A, B params unused. From gcc:

    bd.c:77:17: warning: too many arguments for format [-Wformat-extra-args]
        if (o) printf("%08x\n", o, A, B);
2021-11-13 01:10:45 -08:00
Justine Tunney
777d08a839 Fix mistake with IsHeaderRepeatable 2021-11-12 20:54:30 -08:00
Justine Tunney
98192c1079 Add undocumented IsHeaderRepeatable to redbean
This API is intended to help unblock framework code. It should
ideally be abstracted by redbean which is why it's undocumented.

See #97
2021-11-12 19:03:35 -08:00
Justine Tunney
7064d736e3 Increase some quotas
- Double mem quota (fixes #296) because linking Python is
  expensive and not easily tuned on a case-by-case basis

- Increase latency greatly for mkdeps tool since it's the
  first thing that runs and effetively manages to load
  17,000 files into the hard disk cache (see #97)
2021-11-12 16:38:54 -08:00
Justine Tunney
245a9c206b Fix redbean build
Also ran clang-format on redbean.c

See #312 and #321
2021-11-12 16:34:18 -08:00
Paul Kulchenko
1bdc8faa65
Add redbean function for simple HMAC (#321) 2021-11-12 16:26:14 -08:00