Commit Graph

701 Commits

Author SHA1 Message Date
Omar Polo
07b0a14218 void-ify some functions
their return value is no longer used, it's only confusing at this point.
2021-01-24 09:54:44 +00:00
Omar Polo
0baf6bed2a pass the fd, not the path! 2021-01-24 09:53:54 +00:00
Omar Polo
a87f662565 refactoring state management
instead of having a flag to discern between two different behaviours
in S_SENDING, split that state into S_SENDING_FILE and S_SENDING_CGI
(this will also make it easier in the future to add other sending
states).  While there, also get rid of `goodbye' and make start_reply
advance the state machine by itself.
2021-01-24 09:49:09 +00:00
Omar Polo
a7b9bb4d24 specify in which directory CGI scripts are executed 2021-01-24 09:20:38 +00:00
Omar Polo
05748e49fe chdir to the vhost root before exec'ing the CGI script 2021-01-24 09:15:05 +00:00
Omar Polo
e7a2a99b5a added index option 2021-01-24 09:14:01 +00:00
Omar Polo
9adde3d8b2 reuse the same buffer for the request and response 2021-01-23 17:45:56 +00:00
Omar Polo
6cdecad88d fix test portability
wc return 2048 on fedora (it doesn't count the trailing \n), while on
OpenBSD, Void linux on aarch64 and Alpine linux on vmd(8) returns
2049.
2021-01-23 17:44:23 +00:00
Omar Polo
f62aab517d handle TLS_WANT_POLL{IN,OUT}
libtls doesn't seem to return when doing blocking I/O, but libretls
does every single time.
2021-01-23 17:43:04 +00:00
Omar Polo
2349b02b26 bump the key size a little
on fedora with libretls (running on top of openssl) it won't open the
key otherwise.
2021-01-23 17:42:04 +00:00
Omar Polo
c6b9ddecf6 gg may need some compat 2021-01-23 17:39:12 +00:00
Omar Polo
ce06cdc5bd drop gg.py 2021-01-23 17:11:16 +00:00
Omar Polo
31a4993a94 use gg instead of gg.py for the regression suite 2021-01-23 17:10:00 +00:00
Omar Polo
d760973a5b don't alter the struct iri 2021-01-23 17:07:52 +00:00
Omar Polo
497977d501 add gg, a barebones Gemini client 2021-01-23 16:56:24 +00:00
Omar Polo
3309ef975c accumulate the whole response line for CGI scripts 2021-01-23 15:32:38 +00:00
Omar Polo
45b4aa6e57 fix local libretls example 2021-01-23 12:22:09 +00:00
Omar Polo
1a49166de4 fix date 2021-01-23 11:29:02 +00:00
Omar Polo
e29dbd7217 added missic copyright notice 2021-01-23 11:28:44 +00:00
Omar Polo
7f740a1440 typo 2021-01-22 17:54:37 +00:00
Omar Polo
e0e15c30d7 simplify glob for pem 2021-01-22 17:41:12 +00:00
Omar Polo
dd8cc7d3ce mention testing in readme 2021-01-22 17:28:39 +00:00
Omar Polo
c421bd46ed drop genbigfile 2021-01-22 17:24:33 +00:00
Omar Polo
609fc9f9d9 use a c program to fill the file
it's several order of magnitude faster than the equivalent shell script
2021-01-22 17:18:55 +00:00
Omar Polo
99f95f7762 fix for sha256sum 2021-01-22 17:14:40 +00:00
Omar Polo
7e26256394 fixing compat compilation
include headers if needed and include config.h
2021-01-22 17:00:56 +00:00
Omar Polo
3527b7a58a missing ; in prototype 2021-01-22 16:53:21 +00:00
Omar Polo
30008a68d3 deleted old test stuff 2021-01-22 16:48:18 +00:00
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