Commits


gemini_parse_reply: return code and don't close connection clang static analyzer found a possible use after free: if the code is not 2X in gemini_parse_reply we call close_conn. Then, in net_read we set req->done_header, but req may have been free'd! Actually, this is almost impossible to trigger. close_conn never ends up calling free(req) on its first try, because tls_close takes a while and is rescheduled by libevent. (The check req->ctx != NULL in close_conn is always true if it's a gemini request.) Nevertheless, it's clear to move close_conn out of gemini_parse_reply and simply return the response code: it feels wrong that a "parsing function" takes logic decisions.


declare data as uint8_t *; pointer arith on void * is a GNU extension


move util.c declarations in utils.h it's not spelled `util.h' because otherwise it'd get included instead of /usr/include/util.h


re-create the tls_config for each request this is just to simplify the future additions of client certificates.


handle empty replies (i.e. no header) thanks mansfield for breaking your server so I notice this error


send received page in chunks imsg can't handle buffer "too big" (around INT16_MAX) and solene@ capsule index is ~29K. The 4K chunk size is completely arbitrary.


fmt (some missing space -> tab conversion)


wrap unfreeze in ifdef instead of defining macros in compat.h. It's clearer that it's only for libevent2 this way


unfrozen by default it seems that we can "melt" :P the evbuffer from the start to avoid the unfreeze/freeze dance


buffer is frozen; drain becomes a NOP


fix bufferevent tls I/O on libevent2 on libevent2 we need to wrap evbuffer_add with evbuffer_freeze/evbuffer_unfreeze. Not sure exactly why, probably because we're doing some evbuffer_enable/disable/enable-again. Retain compatibility with the custom libevent1 in base on OpenBSD.


drain read buffer before EOF


initial gopher support


support finger:// urls!


fix possible overflow sizeof(buf) should be equal to howmuch, otherwise we may end up reading with tls_read out of bounds and corrupting the stack.