Commit Graph

173 Commits

Author SHA1 Message Date
Omar Polo 5c2e310ede brand new regress suite 2021-01-22 16:48:04 +00:00
Omar Polo f890c8c54d use a helper to handle no-body replies 2021-01-22 13:58:54 +00:00
Omar Polo 36162ed86d rename goodbye -> close_conn 2021-01-22 13:45:27 +00:00
Omar Polo 42bbdc7978 trim initial forward slashes
this parse gemini://example.com///foo into an IRI whose path is
"foo".  I'm not 100% this is standard-compliant but:

1. it seems a logical consequence of the URI/IRI cleaning algo (where
   we drop sequential slashes)
2. practically speaking serving file a sequence of forward slashes
   doesn't really make sense, even in the case of CGI scripts
2021-01-21 22:48:16 +00:00
Omar Polo f77a8c867e add ends_with 2021-01-21 22:45:49 +00:00
Omar Polo d1ca3911d2 fix redirects
make sure redirect starts with /.  This also requires a tweak in
check_path, in the case we go open_file -> send_dir -> open_file ->
check-path and the path starts with a slash.
2021-01-21 22:44:41 +00:00
Omar Polo 06f233ad8a ensure we're in the correct state 2021-01-21 19:46:36 +00:00
Omar Polo 0ac2dceccc sync changes 2021-01-21 16:19:11 +00:00
Omar Polo 2d7abb7017 add missing getprogname test + eventually include err.h 2021-01-21 16:15:35 +00:00
Omar Polo ea28a44931 const-ify parameter to strtonum 2021-01-21 16:15:10 +00:00
Omar Polo 95210bb396 use recallocarray
it also does an overflow check on multiplication, other than being
more readable.
2021-01-21 16:14:01 +00:00
Omar Polo a5a09e44b2 use strtonum 2021-01-21 16:07:12 +00:00
Omar Polo 5c342d059f more OpenBSD goodies 2021-01-21 15:37:02 +00:00
Omar Polo b2a6b61371 rename mimes to mime ; pass config esplicitly to mime* functions 2021-01-21 15:01:37 +00:00
Omar Polo 20c9ff466b typo 2021-01-21 14:51:09 +00:00
Omar Polo 33ac26a0e5 fix prototypes 2021-01-21 14:49:11 +00:00
Omar Polo 642b37d5ac don't include config.h there 2021-01-21 14:48:26 +00:00
Omar Polo ac69e83aab improve install target 2021-01-21 13:50:11 +00:00
Omar Polo fb2c20c301 fix dockerfile
now we have also some sub-directories, COPY . . is more future-proof
at this point.
2021-01-21 13:49:52 +00:00
Omar Polo 86939cb45b simplify CFLAGS/LDFLAGS autodetection 2021-01-21 13:40:22 +00:00
Omar Polo f980545b58 typo x 2 2021-01-21 13:16:14 +00:00
Omar Polo 04397b3293 typo 2021-01-21 13:14:55 +00:00
Omar Polo 8f0da58068 mention the configure script and how to link to a local libtls 2021-01-21 13:12:35 +00:00
Omar Polo 597ddf6ca8 typo 2021-01-21 13:01:54 +00:00
Omar Polo 12042ad700 add a configure script and some compat
tested on openbsd, alpine and void
2021-01-21 11:57:46 +00:00
Omar Polo 338f06f4e5 drop seccomp.h: not needed 2021-01-21 11:55:52 +00:00
Omar Polo 32befb74a9 drop mention to the static target
it works on OpenBSD but not on alpine, it requires further tweaks.
2021-01-21 09:19:13 +00:00
Omar Polo 1213c735bf sync 2021-01-21 09:17:19 +00:00
Omar Polo de27389e83 add globbing notice and sync example with actual flags 2021-01-21 09:17:13 +00:00
Omar Polo b4d409cf29 use fnmatch on the domain name 2021-01-21 09:07:26 +00:00
Omar Polo 15209ad9ed typo 2021-01-21 08:51:17 +00:00
Omar Polo ce79c944bc simplify flow when SNI is missing
this also gives a chance for users to use the default host even if SNI
is missing.
2021-01-21 08:46:07 +00:00
Omar Polo 0ab65593e2 don't crash on wrong vhost or missing SNI
the new logging code was crashing if the client didn't support SNI or
if required an unknown vhost: this because we short-circuit in
handle_handshake to an error, so c->iri isn't populated yet (we don't
even read the request).

fixes #1
2021-01-21 08:26:21 +00:00
Omar Polo 0be51733ef improve logs
now we log the full IRI requested (before was only the path) and the
response line (even for CGI).
2021-01-20 18:54:44 +00:00
Omar Polo 61f8d630c8 fmt 2021-01-20 16:22:35 +00:00
Omar Polo f2b3a5193f allow clock_gettime and a bit of fmt
alpine on amd64 (under OpenBSD vmd) tries to do a clock_gettime.  I
don't know why, but it doesn't seem a problem to allow it.
2021-01-20 16:19:54 +00:00
Omar Polo 3c0375e405 fix BPF 2021-01-20 16:09:04 +00:00
Omar Polo de4f713184 tighten the rules for fcntl
allow only the F_GETFL and F_SETFL commands
2021-01-20 15:54:26 +00:00
Omar Polo 298e4b96dc explain the poll mess 2021-01-20 15:44:11 +00:00
Omar Polo 2debfe2b1f drop useless field
was probably added to distinguish between AF_INET and AF_INET6, to use
different functions for logging.  But it wasn't really used, and now
we use getnameinfo anyway.
2021-01-19 18:49:36 +00:00
Omar Polo 710a71b2bb don't leak file descriptors 2021-01-19 18:16:09 +00:00
Omar Polo 6119e13e8a moving "default type" from global options to server options 2021-01-19 11:28:41 +00:00
Omar Polo df79b4c1d5 rename reason to meta 2021-01-19 11:00:06 +00:00
Omar Polo 05c23a54ea add "lang" server option 2021-01-19 10:58:29 +00:00
Omar Polo 17b09e3cb7 add a dockerfile 2021-01-18 23:15:45 +00:00
Omar Polo 94a79035ec __NR_poll doesn't seem to be defined on aarch64 2021-01-18 23:08:16 +00:00
Omar Polo 5bc29bc915 remove README.md target
leftover from when README.md was generated by gmid.1
2021-01-18 22:52:13 +00:00
Omar Polo d89aa7630d typo 2021-01-18 22:09:17 +00:00
Omar Polo e7ecf9a528 sync 2021-01-18 21:53:36 +00:00
Omar Polo eb6997835a trying to get the man on par with the recent changes 2021-01-18 21:52:01 +00:00