Commits
- Commit:
acafce5b7ddd4342e45a7731ae3f261e6f202a77
- From:
- Omar Polo <op@omarpolo.com>
- Date:
libevent2 fix: unfreeze the client evbuffer
libevent2 has this concept of "freezeness" of a buffer. It's a way to
avoid accidentally write/remove data from the wrong "edge" of the
buffer. The client_tls_{read,write} functions need to add/drain data
from the opposite edge, hence the need for the unfreeze call.
This is the minimum change in order to work on libevent2 too. Another
way would be to define evbuffer_{un,}freeze as NOP on libevent 1, but
it's ugly IMHO.
- Commit:
efe7d180292726775fb3ae5e6af593490a264c60
- From:
- Omar Polo <op@omarpolo.com>
- Date:
new I/O handling on top of bufferevents
This is a big change in how gmid handles I/O. Initially we used a
hand-written loop over poll(2), that then was evolved into something
powered by libevent basic API. This meant that there were a lot of
small "asynchronous" function that did one step, eventually scheduling
the re-execution, that called each others in a chain.
The new implementation revolves completely around libevent'
bufferevents. It's more clear, as everything is implemented around the
client_read and client_write functions.
There is still space for improvements, like adding timeouts for one, but
it's solid enough to be committed as is and then further improved.
- Commit:
741b69be96397e0ec6db0c84b4ead4f41363ea98
- From:
- Omar Polo <op@omarpolo.com>
- Date:
fastcgi completely asynchronous
This changes the fastcgi implementation from a blocking I/O to an
async implementation on top of libevent' bufferevents.
Should improve the responsiveness of gmid especially when using remote
fastcgi applications.
- Commit:
83fe545a2b8c892e70ecf6b48180c27e6bc6b414
- From:
- Omar Polo <op@omarpolo.com>
- Date:
initialize mbufhead
- Commit:
3571854e942b2354ae216f340add076d71d0776a
- From:
- Omar Polo <op@omarpolo.com>
- Date:
fix possible out-of-bound access
While computing the parent directory it an out-of-bound access can
occur, which usually means the server process dies.
In particular, it can be triggered by making a request for a
non-existent file in the root of a virtual host if the path matches
the `cgi` pattern.
Thanks cage for helping in debugging!
- Commit:
353e3c8ebe516943a38d051a0bf390bb6116574c
- From:
- Omar Polo <op@omarpolo.com>
- Date:
style
- Commit:
a91ad7f2ffac3f1cec0c6c42e780ab5efc92ba5c
- From:
- Omar Polo <op@omarpolo.com>
- Date:
drop unnecessary bzero
the whole struct client is already memset'd to 0 in do_accept.
handle_handshake doesn't touch the request or iri buffer in the code
path that leads to handle_open_conn. (It does so in the error router
alone.)
- Commit:
79288c8b6077a573243c4654e3b3c4948febdb99
- From:
- Omar Polo <op@omarpolo.com>
- Date:
making more explicit the case of missing SNI
Missing SNI (i.e. servname == NULL) is already handled correctly.
puny_decode refuses to work on NULL servname, c->domain is still the
empty string and everything flows as expected towards the error at the
end. However, it's better to bail out early and make more explicit
how the case of missing SNI is handled.
- Commit:
efb48052dcb6788001e7cce089c2b2f375d927c5
- From:
- Omar Polo <op@omarpolo.com>
- Date:
relax openat rule: follow symlinks
O_NOFOLLOW acts only on *the last component*, so on
open("/foo/bar/baz") only when baz is a symlink open fails.
Checking every path component is not viable.
gh issue #5 related (sort of)
- Commit:
a8a1f439210de9538b196c6bb5470c306379128c
- From:
- Omar Polo <op@omarpolo.com>
- Date:
style(9)-ify
- Commit:
090b8a89faa34cdc41c41e32845f1f5b444536e4
- From:
- Omar Polo <op@omarpolo.com>
- Date:
gracefully shut down fastcgi backends
we need to delete the events associated with the backends, otherwise
the server process won't ever quit.
Here, we add a pending counter to every backend and shut down
immediately if they aren't handling any client; otherwise we try to
close them as soon as possible (i.e. when they close the connection to
the last connected client.)
- Commit:
1b78bd563a8779c8be71c0489abb92a61e21f8f1
- From:
- Omar Polo <op@omarpolo.com>
- Date:
strncpy -> strlcpy
quoting strncpy(3)
strncpy() only NUL terminates the destination string when the
length of the source string is less than the length parameter.
strlcpy is more intuitive.
this is another warning gcc 8 found that clang didn't.
- Commit:
24d362cd67c3eba1ce1a6af67eb71b6fce469411
- From:
- Omar Polo <op@omarpolo.com>
- Date:
explicitly use c->fd instead of fd
Yep, fd should be the file descriptor, but for lazyness when manually
calling the function sometimes we supply 0 as fd and event. Instead of
fixing the usage, do as other of such functions do in this
circumstances: use c->fd.
- Commit:
89c88caa3c023d5194e0d572ae99ab006557cbf3
- From:
- Omar Polo <op@omarpolo.com>
- Date:
mark backend as FCGI_READY when getting a fd
otherwise clients will remain stuck waiting for a pending request that
doesn't exist (see apply_fastcgi switch.)
- Commit:
1feaf2a618ee1c4771fee80ced7acf31fe40fdae
- From:
- Omar Polo <op@omarpolo.com>
- Date:
use the correct document root
pass the correct loc_off to the executor, so the various variables
that depends on the matched location (like DOCUMENT_ROOT) are computed
correctly.