diff options
author | Omar Polo <op@omarpolo.com> | 2021-02-12 11:27:33 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-02-12 11:27:33 +0000 |
commit | 27b2fa9ae5d7a3807eea150cef5163931929cc23 (patch) | |
tree | b482966b4d7eb05261906ace926e9f25cf2e5c89 /gmid.h | |
parent | a6e689d7450c532baa306b293314e42c0b64a300 (diff) |
don't mmap
Before we mmap(2) file for reading, and use a buffer to handle CGI
scripts. Turns out, for sequential access over the whole mmap isn't
better than our loop on read. This has also the additional advantage
that we can use handle_cgi (now handle_copy) for both files and CGI,
which is pretty cool.
This also fixes a nasty bug where we could hang a connection forever,
because we scheduled the wrong type of event (read on POLLOUT and
write on POLLIN, it's the other way around!)
Diffstat (limited to 'gmid.h')
-rw-r--r-- | gmid.h | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -171,9 +171,8 @@ struct client { const char *meta; int fd, pfd; DIR *dir; - char sbuf[1024]; /* static buffer */ - void *buf, *i; /* mmap buffer */ - ssize_t len, off; /* mmap/static buffer */ + char sbuf[BUFSIZ]; + ssize_t len, off; struct sockaddr_storage addr; struct vhost *host; /* host she's talking to */ }; |