mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-01 00:38:31 +00:00
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:
parent
26ac6871da
commit
4effa23528
74 changed files with 3710 additions and 14246 deletions
|
@ -30,7 +30,7 @@
|
|||
#define SIG_DFL ((void *)0)
|
||||
#define SIG_IGN ((void *)1)
|
||||
|
||||
#define MAP_FAILED ((void *)__SIZE_MAX__)
|
||||
#define MAP_FAILED ((void *)-1)
|
||||
|
||||
#define ARCH_SET_GS 0x1001
|
||||
#define ARCH_SET_FS 0x1002
|
||||
|
|
|
@ -39,22 +39,24 @@ textwindows int sys_fstat_nt(int64_t handle, struct stat *st) {
|
|||
memset(st, 0, sizeof(*st));
|
||||
switch (filetype) {
|
||||
case kNtFileTypeChar:
|
||||
st->st_mode = S_IFCHR | 0600;
|
||||
st->st_mode = S_IFCHR | 0644;
|
||||
break;
|
||||
case kNtFileTypePipe:
|
||||
st->st_mode = S_IFIFO | 0600;
|
||||
st->st_mode = S_IFIFO | 0644;
|
||||
break;
|
||||
case kNtFileTypeDisk:
|
||||
if (GetFileInformationByHandle(handle, &wst)) {
|
||||
st->st_mode =
|
||||
(S_IRUSR | S_IXUSR |
|
||||
(!(wst.dwFileAttributes & kNtFileAttributeReadonly) ? S_IWUSR
|
||||
: 0) |
|
||||
((wst.dwFileAttributes & kNtFileAttributeNormal) ? S_IFREG : 0) |
|
||||
((wst.dwFileAttributes & kNtFileFlagOpenReparsePoint) ? S_IFLNK
|
||||
: 0) |
|
||||
((wst.dwFileAttributes & kNtFileAttributeDirectory) ? S_IFDIR
|
||||
: 0));
|
||||
st->st_mode = 0555;
|
||||
if (!(wst.dwFileAttributes & kNtFileAttributeReadonly)) {
|
||||
st->st_mode |= 0200;
|
||||
}
|
||||
if (wst.dwFileAttributes & kNtFileAttributeDirectory) {
|
||||
st->st_mode |= S_IFDIR;
|
||||
} else if (wst.dwFileAttributes & kNtFileFlagOpenReparsePoint) {
|
||||
st->st_mode |= S_IFLNK;
|
||||
} else {
|
||||
st->st_mode |= S_IFREG;
|
||||
}
|
||||
st->st_atim = FileTimeToTimeSpec(wst.ftLastAccessFileTime);
|
||||
st->st_mtim = FileTimeToTimeSpec(wst.ftLastWriteFileTime);
|
||||
st->st_ctim = FileTimeToTimeSpec(wst.ftCreationFileTime);
|
||||
|
|
|
@ -659,6 +659,7 @@ typedef uint64_t uintmax_t;
|
|||
#pragma GCC diagnostic ignored "-Wformat" /* forces only gnu pf */
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter" /* extreme prejudice */
|
||||
#pragma GCC diagnostic ignored "-Wunused-function" /* contradicts dce! */
|
||||
#pragma GCC diagnostic ignored "-Wunused-const-variable" /* let me dce */
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable" /* belongs in tidy */
|
||||
#pragma GCC diagnostic ignored "-Wformat-extra-args" /* is also broken */
|
||||
#pragma GCC diagnostic ignored "-Wparentheses" /* annoying tidy */
|
||||
|
|
|
@ -61,7 +61,7 @@ void *mmap(void *addr, size_t size, int prot, int flags, int fd, int64_t off) {
|
|||
struct DirectMap dm;
|
||||
int i, x, n, m, a, b, f;
|
||||
if (!size) return VIP(einval());
|
||||
if (size > 0x0000010000000000) return VIP(enomem());
|
||||
if (size > 0x0000010000000000ull) return VIP(enomem());
|
||||
if (!ALIGNED(off)) return VIP(einval());
|
||||
if (!ALIGNED(addr)) return VIP(einval());
|
||||
if (!CANONICAL(addr)) return VIP(einval());
|
||||
|
|
|
@ -35,7 +35,7 @@ extern uint8_t __zip_end[]; /* αpε */
|
|||
|
||||
void mcount(void);
|
||||
unsigned long getauxval(unsigned long);
|
||||
void *mapanon(size_t) vallocesque attributeallocsize((1));
|
||||
void *mapanon(size_t) attributeallocsize((1));
|
||||
int setjmp(jmp_buf) libcesque returnstwice paramsnonnull();
|
||||
void longjmp(jmp_buf, int) libcesque wontreturn paramsnonnull();
|
||||
int _setjmp(jmp_buf) libcesque returnstwice paramsnonnull();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue