Commit Briefs

Thomas Adam

gotwebd: inline and remove IMSG_SIZE_CHECK()

I always find confusing if IMSG_SIZE_CHECK() takes pointers or not, and we had at least a few instances of wrong usages, so inline (with exact size checks) and remove the macro. ok stsp@


Thomas Adam

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@


Thomas Adam

gotwebd: define constant instead of using the magic number 3

suggested by stsp@


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@


Thomas Adam

gotwebd: improve gotwebd_assign_querystring()

This prevents the issues that we just hit with forgetting to remove PREVID: instead of relying on the enum value to yield the size of a table, use nitems(). Also, quit as soon as the matching key was found, no need to iterate further. ok stsp@


Thomas Adam

gotwebd: garbage-collect PREVID, removed long time ago

This leftover kept QSELEM__MAX bigger than the querystring_keys[] table and causes gotweb_assign_querystring to go out of bounds. Spotted on alpine (thanks to -portable.)


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@


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@


Thomas Adam

gotwebd: merge host() and get_addrs(); use * instead of "" for any addr

ok plus tweaks stsp@


Thomas Adam

gotwebd: render all the datetimes in a time tag

fixes an unused variable that should have been dropped in previous commit too. ok stsp@



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


Thomas Adam

simplify gotwebd' server matching

Currently, if there is not a match on the server name, it attempts to match the "subdomain" against the server names, and fall back to the first server defined. The server name is taken from the SERVER_NAME fastcgi' parameter, the subdomain extracted from HTTP_HOST. Keep only the SERVER_NAME matching, but still use the first server defined if there's no match. Fix the manpage documenting how matching works and drop the lie about SNI as gotwebd doesn't do TLS but just looks at what the upstream http server decided. ok stsp@


Thomas Adam

change got_get_repo_tags' limit argument to size_t

The function already carefully avoids wrapping around zero. While here add a sanity check for limit == 0, like what was previously done for got_get_repo_commits().


Thomas Adam

gotwebd: make got_get_repo_commits take a size_t

and while here make sure 0 is rejected. requested by, improvements and ok stsp@


Thomas Adam

gotwebd: drop unused `prefixlen' from struct address

ok stsp@


Thomas Adam

fix the size of gotwebd's array of tempfiles used for deltas

Prevents ftruncate() errors due to bogus file descriptors passed from gotwebd once the repository layer runs out of temporary files to use for deltas. Have gotwebd open the maximum amount of required temporary files for now. A proper fix which scales to lower ulimit -n settings can be implemented later. Problem reported by patrick@


Thomas Adam

rename got_gotweb_flushfile -> got_gotweb_closefile

suggested and ok millert@


Thomas Adam

simplify got_gotweb_openfile/flushfile

Return only the FILE *, and require only that to close subsequently. Having to manage the file descriptor too makes using these functions unnecessary complex. millert@ agrees


Thomas Adam

gotwebd: reply with non-200 HTTP status code on error

ok tracey@


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@


Thomas Adam

gotwebd: fix briefs/tags navigation overlap

Introduces a separate field for the "next" button (now called "More") and adjusted the CSS/HTML so it's used. Finally, drops the old code used to handle the pagination for the BRIEFS/COMMITS cases. Needs a small hack for the time being, setting the action to TAGS. This is due how qs->action is changed in gotweb.c while handling the request. ok jamsek


Thomas Adam

gotwebd: turn gotweb_get_time_str into gotweb_render_age

ok jamsek


Thomas Adam

gotwebd: refactor gotweb_render_content_type/_file

Rework them so that they allow to set the Status header (the HTTP status code; only way since we're behind FastCGI) and optionally a Location. Since they're now unused outside of gotweb.c, mark them as static. They also used to always return NULL so the error is pointless; return the -1 on failure though. While here, rename to gotweb_reply and gotweb_reply_file. ok jamsek


Thomas Adam

gotwebd: delete now unused code

gotweb_escape_html and gotweb_link are now completely unused. ok jamsek