Commit Graph

683 Commits

Author SHA1 Message Date
Omar Polo
1feaf2a618 use the correct document root
pass the correct loc_off to the executor, so the various variables
that depends on the matched location (like DOCUMENT_ROOT) are computed
correctly.
2021-05-15 10:31:43 +00:00
Omar Polo
91b9f2a8f9 const-ify strip_path 2021-05-15 10:07:21 +00:00
Omar Polo
571d20fbb3 fmt 2021-05-15 10:04:58 +00:00
Omar Polo
0773413c1d correct the description of `strip'
now it's also used in the path lookup process
2021-05-15 09:51:45 +00:00
Omar Polo
1eb3631d10 certificate generation (bugfix and improvement)
don't add gmid as organisation when generating the certificate, and
set the version to 3, so it's compatible with java/android clients.

Found by Gnuserland, thanks!
2021-05-12 17:37:22 +00:00
Omar Polo
58d51f2c11 gmid don't enforce anymore that a root is specified 2021-05-11 20:20:02 +00:00
Omar Polo
23a5aab4ce drop forward declaration of struct client
it's been since the switch to libevent that is no longer needed.
2021-05-11 19:41:16 +00:00
Omar Polo
84821dc0ac sync 2021-05-09 18:31:18 +00:00
Omar Polo
8ad1c57024 fastcgi: a first implementation
Not production-ready yet, but it's a start.

This adds a third ``backend'' for gmid: until now there it served
local files or CGI scripts, now FastCGI applications too.

FastCGI is meant to be an improvement over CGI: instead of exec'ing a
script for every request, it allows to open a single connection to an
``application'' and send the requests/receive the responses over that
socket using a simple binary protocol.

At the moment gmid supports three different methods of opening a
fastcgi connection:

 - local unix sockets, with: fastcgi "/path/to/sock"
 - network sockets, with: fastcgi tcp "host" [port]
   port defaults to 9000 and can be either a string or a number
 - subprocess, with: fastcgi spawn "/path/to/program"
   the fastcgi protocol is done over the executed program stdin

of these, the last is only for testing and may be removed in the
future.

P.S.: the fastcgi rule is per-location of course :)
2021-05-09 18:23:36 +00:00
Omar Polo
50310aff33 added missing prototype 2021-05-04 18:19:47 +00:00
Omar Polo
419e32b05e sync 2021-05-03 16:12:53 +00:00
Omar Polo
c705ecb1ba factorize all "only once" checks
and while there add some more
2021-05-03 16:11:28 +00:00
Omar Polo
7b2d743260 move pidfile & cgi to global vars 2021-05-01 12:17:42 +00:00
Omar Polo
7aa9258633 make more explicit the per-location roots test 2021-04-30 19:08:27 +00:00
Omar Polo
737a6b50c5 ensure %p (path) is always absolute
with the recent changes, sometimes the path may not start with a '/'.
This ensures that %s is ALWAYS an absolute path.
2021-04-30 19:07:37 +00:00
Omar Polo
fdea6aa0bc allow ``root'' rule to be specified per-location block 2021-04-30 17:16:34 +00:00
Omar Polo
adbe6a6493 always use ensure_absolute_path and improve its error message 2021-04-30 16:17:07 +00:00
Omar Polo
17a04409b5 typo in docker example 2021-04-29 19:52:50 +00:00
Omar Polo
8070ffa70f typo (again) 2021-04-29 19:50:25 +00:00
Omar Polo
7a4f742657 typo 2021-04-29 19:48:47 +00:00
Omar Polo
08ce6f5273 tweaked the readme a bit 2021-04-29 19:46:51 +00:00
Omar Polo
d06d6f4bba sort tokens 2021-04-29 19:13:16 +00:00
Omar Polo
6a5e709beb typo: missing Ic 2021-04-29 18:29:55 +00:00
Omar Polo
cc8c2901ad added ``alias'' option to define hostname aliases for a server 2021-04-29 18:23:35 +00:00
Omar Polo
8e8b2e252c pidfile support with `-P pidfile' 2021-04-28 12:45:22 +00:00
Omar Polo
2ef7f631db wait for logger after fatal()
With -f, when the main process exits after a fatal() (usually) the
shell prompt is printed before the logger message.

This adds a small poll to wait for the logger process to exit.
2021-04-28 12:43:17 +00:00
Omar Polo
48b69cb2dc fix some logging
- we can't use log_* or fatal() before logger_init
- err -> errx if errno isn't involved
2021-04-28 12:43:17 +00:00
Omar Polo
d89a9060f8 fatal: send log to logger 2021-04-28 12:43:17 +00:00
Omar Polo
42447f673f send priority to the logger process 2021-04-28 12:43:17 +00:00
Omar Polo
9cc630aa63 added ``env'' option to define environment vars for CGI scripts 2021-04-28 12:43:17 +00:00
Omar Polo
e6ca8eb156 lower log priority for fatal errors from CRIT to ERR
found by Anna, thanks!
2021-04-28 12:43:17 +00:00
Omar Polo
419a423520 keep verbosity level after config reload 2021-04-28 12:42:36 +00:00
Omar Polo
c79b63f580 typo 2021-04-27 07:14:00 +00:00
Omar Polo
1b333122a9 typo 2021-04-26 20:58:06 +00:00
Omar Polo
578f13e4b2 add compat for reallocarray 2021-04-25 12:50:19 +00:00
Omar Polo
b5fdc32e75 use memcpy instead of bcopy
memcpy is ANSI C89, bcopy seems to be an history BSD function.
2021-04-25 12:49:21 +00:00
Omar Polo
5aba63956a d->d_namelen doesn't seem to be available on linux 2021-04-25 12:45:17 +00:00
Omar Polo
e76f2c74b8 don't save the directory fd in c->pfd
scandir_fd already calls closedir, which in turns closes the fd
2021-04-25 12:19:06 +00:00
Omar Polo
11c986679a sort the auto index alphabetically 2021-04-25 12:06:54 +00:00
Omar Polo
bb4be662f1 specify the develop process 2021-04-25 12:01:34 +00:00
Omar Polo
072e3557c4 build gmid statically inside the docker container 2021-04-24 19:54:22 +00:00
Omar Polo
0bfdcb1799 missing comma , 2021-04-22 19:10:08 +00:00
Omar Polo
4d820b6cd2 use `text/x-patch' for .patch and .diff files 2021-04-21 07:51:29 +00:00
Omar Polo
5d1474a561 typo in comment 2021-04-20 09:53:33 +00:00
Omar Polo
3841a36930 restore signal handlers before exec'ing CGI scripts 2021-04-20 09:53:03 +00:00
Omar Polo
74c0c7e4ce rename reschedule_* to yield_* 2021-04-20 09:40:09 +00:00
Omar Polo
3f47867e1d typo... in the program name...
Just how retarded can I be?
2021-04-16 13:28:56 +00:00
Omar Polo
b7a9906151 typo 2021-04-15 20:14:18 +00:00
Omar Polo
dafaf46734 change description of `entrypoint' 2021-04-15 20:13:44 +00:00
Omar Polo
1de922891b typos 2021-04-15 19:43:46 +00:00