Age | Commit message (Collapse) | Author |
|
scandir_fd already calls closedir, which in turns closes the fd
|
|
|
|
|
|
|
|
saves some bytes of memory and removes the limit on the maximum number
of vhosts and location blocks.
|
|
while there, add capsicum for the logger process
|
|
use imsg to handle ALL kinds of IPC in gmid. This simplifies and shorten the
code, and makes everything more uniform too.
|
|
log.o is linked to some regress/ stuff. Calling from there a vhost_*
function means that we should link the regress/stuff to server.o too
(and that would pull in other stuff...). Moving the call is easier,
and also probably better.
|
|
|
|
|
|
|
|
|
|
Include gmid.h as first header in every file, as it then includes
config.h (that defines _GNU_SOURCE for instance).
Fix also a warning about unsigned vs signed const char pointers in
openssl.
|
|
accept4(2) isn't part of any standard (even though it'll be part in
the future) and raises warnings on some linux distro. Moreover, we
don't have thread that may fork at any time, so doing a mark_nonblock
after isn't a big deal.
|
|
|
|
|
|
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!)
|
|
the old server processes would stick around waiting on the signals
events. While there, also drop the `struct server_events' and define
events as globals.
|
|
reported by devel at datenbrei dot de. The first location would
overwrite the default value for a server, triggering the "`foo' rule
specified more than once" error. This also needed a small tweak on
how we match locations to avoid breaking other tests.
|
|
|
|
move the strip and fmt logic to their own function
|
|
add/remove syscalls from the BPF filter and move sandbox() after
libevent initialisation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it's faster (statistically speaking) to first compute if the option is
set and then fnmatch than the inverse. This way we can avoid
unnecessary fnmatch.
|
|
|
|
|
|
|
|
it's a waste to loop through all fds. We know the *exact* number of
clients that needs attention, so use that information to limit the
looping.
|
|
keep mark_nonblock in utils.c, as otherwise the build for the regress
suite will fail (mark_nonblock needs fatal which is in gmid.c, and
we can't link gmid.o with the regress suite...)
|
|
|
|
By marking all those function as static, the compiler is free to do
more optimizations. In addition, those functions are not used outside
server.c
|
|
|
|
|
|
Now that I got rid of the enum+switch, adding more state is easier.
Before, we used an hack to remember if we had read the CGI reply or
not (c->code = -1).
This introduces a new state, handle_cgi_reply that reads the CGI
script reply, logs it, and only then switches to handle_cgi.
handle_cgi itself is cleaner, now it only reads into c->sbuf and send
what it had red.
We even get, almost for free, the 42 error. If read exists with -1 or
0 from in handle_cgi_reply, we return a proper error to the client.
We can extend this further in the future and also try to validate the
CGI reply (for now we're only looking for a \n).
|
|
So we don't re-enter the handle_handsahke and re-do the loop on
fnmatch etc. This way, once we're successfully past the handshake,
we'll re-enter no handle_open_conn.
|
|
|
|
|
|
|
|
It's how httpd(8) does it, and it allows us to call fnmatch less time
|
|
|
|
|
|
I'll re-enable this when i'll improve the logging
|
|
|
|
|
|
|