aboutsummaryrefslogtreecommitdiff
path: root/gmid.h
AgeCommit message (Collapse)Author
2024-08-23work around comically tiny HOST_NAME_MAX on glibc systemOmar Polo
glibc is clearly violating POSIX since they set HOST_NAME_MAX to 64, and they've known so for years. Unfortunately this means that, despite using the right interfaces, we have to work around bugs in their libc. ugh. Luckily, gmid doesn't need to do DNS, it just needs a define large enough to store a hostname, but not unlimited, to catch possible misconfigurations. We don't risk to round-trip this into an interface that expects smaller strings. Reported and fix tested by Anna “CyberTailor”, see <https://codeberg.org/op/gmid/issues/3>.
2024-08-03proxy-protocol: accept cross-family proxyingOmar Polo
Due to a strict interpretation of the spec if "TCP4" is used we expect two ipv4 addresses (and similar for "TCP6" and ipv6 addresses). However, the family specified in the proxy header matters only for the first address (the source), not the destination! After all, it's not strange to proxy from/to ipv4 and ipv6. Use getaddrinfo(NI_NUMERICHOST) to parse the IP addresses since inet_pton() is too strict.
2024-08-03add support for using the proxy protocol v1 when proxying tooOmar Polo
This is symmetrical to the support for *incoming* requests. The new regress case uses this to proxy to itself using the proxy-protocol v1. Fixes https://github.com/omar-polo/gmid/issues/31
2024-07-08change the type for read_posOmar Polo
2024-07-08s/should_buffer/proxy_protoOmar Polo
2024-07-08fmtOmar Polo
2024-06-17replace asserts with error returnsOmar Polo
2024-06-17inline PROXY_PROTO_PARSE_* and EXPECT_SUCCESS macrosOmar Polo
2024-06-17add a proxy-v1 keyword to enable the proxy protocol handlingOmar Polo
2024-06-17add support for the proxy protocol v1Christoph Liebender
This allows to use proxies like nginx or haproxy in front of gmid and still have the correct information about the originating client. This will need explicit opt-in via the `proxy-v1' listen flag which will be added in a follow-up commit. Merges https://github.com/omar-polo/gmid/pull/30
2024-06-09shutting_down is no longer used, remove stale externOmar Polo
2024-06-09yyerror is already defined (locally) in parse.yOmar Polo
2024-06-09remove from gmid.h functions that are used only in gemexpOmar Polo
2024-06-08change the approach for strnvisOmar Polo
instead of making things more obscure via gmid_strnvis(), let's just check for strnvis with -Werror so we can swap the OS broken implementation with the bundled OpenBSD one.
2024-06-06attempt to deal with the portability fiasco of strnvis(3)Omar Polo
2024-05-29pretty-print the socket address at configuration parsing timeOmar Polo
saves a getnameinfo(NI_NUMERICHOST) at runtime, even if it's pretty cheap.
2024-03-12remove dead codeOmar Polo
2024-01-09fix configtest with chrootOmar Polo
The configtest checks try to open the root directories too, operation that can fail when they're expected to be inside a chroot.
2024-01-08fix ge^W gemexp version stringOmar Polo
2023-10-18rework gencert(); make gemexp generate EC certsOmar Polo
Taking inspiration from acme-client.
2023-08-11remove not so useful starts_with()Omar Polo
replace its only usage with strncmp(). it's likely faster too.
2023-08-11remove a long, long unused functionOmar Polo
2023-08-09don't call client_close() from fcgi/proxy bev handlersOmar Polo
We might end up calling client_close() from start_reply(), but that will free the fcgi/proxy bufferevent while they're still used on the stack. Instead, start_reply() only sets REQUEST_DONE and exits, returning the error eventually, so callers know when to stop.
2023-08-08implement fastcgi strip numberOmar Polo
2023-08-08remove prototype for function killed long agoOmar Polo
2023-08-08move strip_path to utils.cOmar Polo
2023-08-07try hard at loading the configuration during conftest (-n)Omar Polo
Attempt to do also a few more steps that were previously done only at runtime. This can help verifying that the keypairs are matching for example, but also that there are no typos in the path to the root directories. Was requested some time ago by Marian Mizik, thanks for the feature request!
2023-08-07add `log syslog facility' to use a different syslog(3) facilityOmar Polo
Was requested ages ago by Karl Jeacle, now that there is some better support for configuring the logging there's no excuse to add this. It helps with filtering from syslog.d / syslog.conf.
2023-08-03actually use the specified log styleOmar Polo
2023-07-26add log syslog off; don't turn syslog off when log access is specifiedOmar Polo
2023-07-26rename IMSG_LOG_TYPE to ACCESSOmar Polo
2023-07-25allow to change the logging style; introduce some new onesOmar Polo
add `log style <style>'; The old default is called `legacy' now, a new default format is added called `condensed', and `common' and `combined' to mimick Apache httpd and nginx (respectively) are also added.
2023-07-24add ability to log to files with log access <path>Omar Polo
2023-07-23remove unused IMSG typesOmar Polo
2023-07-23add `fastcgi off' to forceful skip fastcgi for a routeOmar Polo
2023-07-23revamp fastcgi configuration: make it per-locationOmar Polo
this revamps the syntax in the configuration to better match httpd(8) (and in general be less weird) and to allow per-location fastcgi configurations. the bare `param' is now deprecated, but for compatibility it acts like `fastcgi param' would do now. Same story for `fastcgi <path>'.
2023-07-23move struct envlist and alist upOmar Polo
2023-07-22split out iri.h from gmid.hOmar Polo
2023-07-01rename do_accept() -> server_accept()Omar Polo
2023-07-01change log_request to take the code and meta unpackedOmar Polo
don't know what i was smoking when I wrote log_request() like that...
2023-07-01parse (and log) the header from fastcgiOmar Polo
2023-07-01simplify request handlingOmar Polo
get rid of check_path(), it's overly complicated. Instead, inline open_file() in client_read() and rework open_dir() to just use openat() instead of the complicate dance it was doing. Simplify open_dir() too in the process: if the directory entry for the index is not a regular file, pretend it doesn't exist.
2023-06-26call getnameinfo() only once per requestOmar Polo
2023-06-24copyright years++Omar Polo
2023-06-24load the certs per listening addressOmar Polo
2023-06-24send host addresses to the server processOmar Polo
2023-06-23implement `listen on'Omar Polo
Listening by default on all the addresses is so bad I don't know why I haven't changed this before. Anyway. Add a `listen on $hostname port $port' syntax to the config file and deprecate the old "port" and "ipv6" global setting. Still try to honour them when no "listen on" directive is used for backward compatibily, but this will go away in the next next version hopefully. At the moment the `listen on' in server context don't filter the host, i.e. one can still reach a host from a address not specified in the corresponding `liste on', this will be added later.
2023-06-23rename client->addr to raddr (remote address) and keep original lengthOmar Polo
2023-06-12load_ca: get a buffer instead of a fdOmar Polo
We dup(1) the ca fd and send it to various processes, so they fail loading it. Instead, use load_file to get a buffer with the file content and pass that to load_ca which then loads via BIO.
2023-06-11disable the privsep crypto engine on !OpenBSDOmar Polo
it fails bandly at runtime on various linux distros and on freebsd. Until a fix is found, disable it so I can move forward.