Commit Briefs

f85c939fb7 Thomas Adam

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@


7d1d4b6ff2 Thomas Adam

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@


2edd250dd9 Thomas Adam

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@



79e60db648 Thomas Adam

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@


d8bf4f258c Thomas Adam

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!)


102d840de7 Thomas Adam

dropping unnecessary strlen()s

ok jamsek, stsp


e19f804004 Thomas Adam

gotwebd: drop unused `prefixlen' from struct address

ok stsp@


161663e7eb Thomas Adam

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@


2e9bd5cb1a Thomas Adam

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@


4fccd2fe0f Thomas Adam

portable: configure: split out dependencies

Rather than assume all dependencies are required for all programs, split them out. This will make packaging easier, as well as splitting the code to use subprojects. Note that due to the use of config.h semantics, in most cases the got_compat.h header file is now at the top of the .c file it is included in, so that it can handle the system header inclusion properly.


e7e5fa49fc Thomas Adam

gotwebd: start using the template system

ok tracey@


55e6cffd21 Thomas Adam

make gotwebd cache open repository handles in struct server

ok op@


e4c7e0b01e Thomas Adam

allow multiple "listen on" statements per server in gotwebd.conf

ok tracey


75716fd6ed Thomas Adam

portable: sockets: handle sa_len/ss_len portably

In the sockaddr_storage struct, there can be a ss_len field. This is seen on some BSDs, but not Linux. Since this isn't POSIX-specific, there's no guarantee it will be available on all systems.


1f6ec06842 Thomas Adam

mark functions internally used by sockets.c as static

ok tracey


c19738c9ed Thomas Adam

fix previous: store port number in host byte order, convert for struct sockaddr

With the previous patch the listen port was correct, but the debug log output was still displaying the swapped port number. Now both listen behaviour and debug log output agree.


9d7714e36f Thomas Adam

gotwebd: struct socket_conf can only use a single address, so don't use a list

ok tracey


720c2b0511 Thomas Adam

gotwebd: initialize IPv4 and IPv6 sockets in the same way

ok tracey


90d63d4711 Thomas Adam

gotwebd: do not allocate server/socket list heads separately

ok millert@


62f852145b Thomas Adam

gotwebd: do not allocate address list heads separately, this is unnecessary

ok millert@


717a78d4f8 Thomas Adam

fix snprintf error handling

follow the "proper secure idiom" described in the CAVEATS section of printf(3). reminded by tb@ and millert@


275b5ade3a Thomas Adam

remove the last remaining use of sin_len from gotwebd

I don't think this assignment to sin_len is needed at all, because sin_len is already being set via got_sockaddr_inet[6]_init() during the configuration stage. Tested successfully on both fcgi socket types (unix / tcp).


ceac46c9c7 Thomas Adam

fix potential type mismatch between format specifier and argument

Cast argument of type rlim_t to unsigned long long to match the %llu format specifier on platforms where this might not be the case.


8b925c6ccd Thomas Adam

portable: add back sys/queue.h

Now that the handling of including sys/queue.h is better, there's no need to remove those lines from the source. Copy the location of those original sys/queue.h lines from upstream at the same line number, so as to avoid any conflicts in the future.