Commit Briefs

Omar Polo

fix logging during gotwebd shutdown

During `rcctl stop gotwebd' the sockets process gets a SIGTERM and dies, and this makes the parent process assume it exited abnormally. Instead, catch SIGINT and SIGTERM and exit gracefully. Issue reported by xs on IRC. ok jamsek


Omar Polo

gotwebd: fix broken signal catching due to a pasto

While here, remove completely the libevent handling of SIGPIPE in favour of the already existing signal(3) call to ignore it; there's no point in logging a SIGPIPE.


Stefan Sperling

remove the gotwebd repository cache

It only had 4 slots so was never quite useful, and sharing of sock->pack_fds across cached repositories seems problematic. with help from + ok op@



Omar Polo

gotwebd: get rid of proc.[ch]

proc.c really shines when there's a network of different types of processes, potentially with a various number of instances each, that needs to exchange messages. Gotwebd instead has a much simpler design, and using proc.c causes more overhead (/headaches) than it solves. So, this attempts to provide the same functionalities but with a much simpler implementation that fits gotwebd better. ok stsp@


Omar Polo

gotwebd: clean up sockets_create_socket a bit

Instead of hardcoding the flags, keep ai_{family,socktype,protocol} from the getaddrinfo() call and apply them here. ok stsp@


Omar Polo

gotadmin: get rid of got_sockaddr.[ch] usage

It was added due to gotwebd weird structure sockaddr_storage handling. Instead, save the size reported by getaddrinfo() and not reach into the struct sockaddr_storage at all (except for extracting the port number for diagnostics purposes.) sockets_conf_new_socket_fcgi() gets an hardcoded ipproto to zero (which is the only value it can get in practice, and keeps for the moment the hardcoded SOCK_STREAM. It'll be cleaned in a follow-up. ok stsp@



Stefan Sperling

fix gotwebd unveil permissions

The main process doesn't need write access anywhere and /tmp is not needed. The sockets process didn't use unveil at all so far, but is happy with just "x" for libexec helpers and "r" for each server's repository path. Input from op@ Tested by myself and Kyle Ackerman who also reviewed the diffs. Prompted by questions from mlarkin@ ok mlarkin@, op@


Omar Polo

gotwebd: move the buffering from the fastcgi layer to the template

Reduces the indirection in fcgi.c, starts to make the struct template opaque, simplifies the template usage. All with a net negative :-) reads fine to stsp@ (thanks!)


Omar Polo

dropping unnecessary strlen()s

ok jamsek, stsp


Omar Polo

gotwebd: drop unused `prefixlen' from struct address

ok stsp@


Omar Polo

gotwebd: provide gotweb_render_page() entrypoint for all pages

simplify gotweb_process_request more, handling all the pages inside the big switch. There's only one entrypoint for rendering the templates gotweb_render_page() that takes the page' content as argument. The only real difference is that gotweb_render_index() now skips directory entries which fails to handle. ok tracey@


Omar Polo

gotwebd: handle short reads and timeouts

If a short read happens, or if all the fastcgi record to read don't fit in the buffer, gotwebd fails to continue reading and hits the timeout. If this happens before gotweb_process_request is called, it will crash in gotweb_free_transport since c->t will be NULL. This register the event with EV_PERSIST so fcgi_request is called again when there's more to read and guards gotweb_free_transport. It also makes spaces for the records as soon as they're successfully parsed. With lots of help from stsp ok stsp@


Omar Polo

gotwebd: start using the template system

ok tracey@