Commits


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@


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


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@


gotwebd: lower log priority of unexpected disconnections no need to be so loud when a client disconnects earlier than expected, log it only in verbose mode. Don't log GOT_ERR_CANCELLED too since that is only used to communicate the callers that we need to stop. ok stsp@


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@


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@


gotwebd: add an RSS feed for the tags ok tracey@


gotwebd: use DOCUMENT_URI rather than SCRIPT_NAME the latter is empty when serving from a directory-like path prefix with an httpd.conf(5) as per gotwebd(8). ok tracey@


gotwebd: start using the template system ok tracey@


gotwebd: percent-encode generated URLs This adds a new helper function `gotweb_link' that outputs an HTML link with the parameter correctly escaped. ok stsp@


gotwebd: plug leak in fcgi_parse_params fcgi_parse_params parses fastcgi parameters into a list. (This is a leftover from slowcgi where that list is later used to populate the environment of the CGI process.) However, this list is never looked at and its memory never released, so just drop it. Make the matching on fastcgi parameters name strictier by checking also that the length is the one we expect; otherwise we might pick up parameters with the same prefix string (i.e. FOO vs FOO_WITH_SUFFIX) While here turn some bcopy into memcpy and simplify some if-nesting too. Fix the reading from an un-initialized pointer that I introduced in a previous commit. ok stsp@


gotwebd: use SCRIPT_NAME to derive URLs This makes gotwebd use SCRIPT_NAME instead of the DOCUMENT_ROOT fastcgi param to generate the links to the assets and changes some links so every page is consistently linked with a relative URL. It allows to drop the `root "/"' in the location for fastcgi and, as a bonus, also makes possible to run gotwebd on non "/" paths. ok stsp@


gotwebd: add fcgi_printf instead of fcgi_gen_response which outputs only a fixed strings provide a printf-like fcgi_printf: it greatly simplifies the generation of the HTML pages. While here also (probably) fix some HTML errors: the output was verified with the W3C validator and it's correct (in the sense that the tags are properly closed, there are still some other things the validator complains about.) ok/encouragement baseprime@, ok jamsek Thanks for reading such a boring diff!


gotwebd: add a some buffering This adds some buffering to fcgi_gen_binary_response so that we don't end up sending too many (very) small fastcgi records. While here also make fcgi_send_response non-void and make its errors "sticky". ok tracey@


gotwebd: avoid large allocation per fcgi record while here also wrap fcgi_send_response to make sure we don't end up trying to send a fcgi record bigger than allowed. ok tracey@


tweak op@ log_debug output


fix logging of fcgi_send_response as originally intended by tracey@


gotwebd: handle partial writes fcgi_send_response can end up trying to send big amount of data, in particular when serving blobs. if a write failure occurs, gotwebd and httpd go out of sync and "bad stuff happens". debugged with and ok tracey@


implement fcgi_gen_response on top of fcgi_gen_binary_response ok tracey@


import gotwebd thread fcgi response to client for rendering in browser as data is returned fix potential problem with a stuck loop if the client is hammering the server with random clicks and stop/restarts render our index! WOOHOO! small var refactoring. fcgi.c to handle all clean-up, various error clean-up remove output used to trace down got bug temporarily stop overloading a socket, but a better solution needs to be found return on fcgi_gen_response, so we can track if a client is writable or not this stops page creation when the client is unavailable remove old comments enable profile building, although, i don't think this works thoroughly in a priv/proc daemon catch more errors correctly count repos remove temp logger we don't need to start our responder thread so early. move it to fcgi.c and start when we start processing html kill the unneeded thread, stop queueing responses, and just write to clients immediately clean up some memory leaks and dead stores rework querystring so an error can be displayed instead of showing the index on querystring error get framework in place for the rest of the content add server struct to response struct bo last commit get back a usable gotweb. not sure what i was thinking yesterday properly move our structs around this time remember index page for sitelink, fix leak unused var is annoying, so stop it for now. don't forget to change this! style briefs nearly completed. finish briefs output add briefs to summary cleanup some html properly retrieve next and previous commit ids for list navigation follow naddy's stailq macro change we will never have a previous link on the summary page goto correct label, so we get a previous link on the last page of briefs don't wrap short line simplify got_get_repo_commits code start rendering a diff start rendering a diff this was by accident finish diff output functions cleanup prepare for fd request that was a stupid idea, just flush the priv_fd bo that too. that won't work eith with append in mkstemp that isn't going to work actually zero out the priv_fd missed seek to beginning of file was overwriting first line of diff fsync our fd as well add link to repo path by sitelink and add back verbose fcgi debugging that was removed add modest write heuristics to fcgi_send_response fix dead assignments and XXX comment where a leak is happening that I can't find right now there was no leak. stsp is brilliant and knew it was the cache growing prevent double-free, render prettier err output if we can remove unused variables correctly fix double-free fix gotwebd to build with main's changes after rebase fix double-free don't error on index if pack files missing and fixup some error handling render commits finish up tag briefs and start the tag page finish up tag page unbreak TAGS and SUMMARY actions grab the correct tag from the queue unbreak TAGS and SUMMARY actions again update some error handling clean up unneeded code and start tree output render tree render branches remove tags from summary if there aren't any fix tree div structure and start blob render render blob render blame fix tree href in briefs clean up some css add headref to querystrings load correct commit for tree and diff fixup some error output update some copyright dates add full SNI support rm debug line found by Lucas6023, notified via IRC. thanks!! fix tree fix crash when querystring is manipulated to not have a commit id in certain instances. also break a stuck while loop on client error. fix for new got_object_id_by_path arguments rebase and fix prep for multiple fds per socket, instead of just one fix overlooked shift/reduce conflicts backout priv_fds as a list. after discussion with stsp, an array and length are the better direction prepare array of fds to pass into got functions make a new set of pack fds, which will be passed to got_repo_open work with new pack_fds in got_repo_open give output when no tags exist escape html in blame output change files listed in tree view to show blob, file commits, and blame, instead of blob, blob, blame. idea from mp4 on irc. this is way more handy. stop populating the queue from the headref and figure out previous commit id while iterating. this should reduce some overhead. actually purge our sockets instead of not using the function start work with new blob rm volatile use new diff change func names no more temp files increase blame number line width set content-type to text/plain so firefox won't download files rm test infra for now account for -Wwrite-strings fix for sigs and algorithm choice clean up some leaks and other mistakes