Commit Graph

554 Commits

Author SHA1 Message Date
Omar Polo e952c5052a allow sending fd to log on to the logger process
the logger process now can receive a file descriptor to write logs
to.  At the moment the logic is simple, if it receives a file it logs
there, otherwise it logs to syslog.  This will allow to log on custom
log files.
2021-06-15 08:06:10 +00:00
Omar Polo 0f2124e291 add some simple test for fastcgi
and while there reorder the targets in the Makefile a bit
2021-06-12 13:47:01 +00:00
Omar Polo 03fcfb79d6 add simple fcgi application for test purposes 2021-06-12 13:46:05 +00:00
Omar Polo 24d362cd67 explicitly use c->fd instead of fd
Yep, fd should be the file descriptor, but for lazyness when manually
calling the function sometimes we supply 0 as fd and event.  Instead of
fixing the usage, do as other of such functions do in this
circumstances: use c->fd.
2021-06-12 13:42:43 +00:00
Omar Polo 89c88caa3c mark backend as FCGI_READY when getting a fd
otherwise clients will remain stuck waiting for a pending request that
doesn't exist (see apply_fastcgi switch.)
2021-06-12 13:41:33 +00:00
Omar Polo e18b070da8 indentation 2021-06-12 12:35:15 +00:00
Omar Polo ab1e0169b9 free fastcgi param list 2021-06-12 10:20:36 +00:00
Omar Polo 3b33eab3ad TAILQ_REMOVE env and aliases during config_free
it's not technically required, since a couple of lines below we free
whole host struct, and we don't have code that may use
h->{env,aliases} afterwards, but it's nice not to have invalid
pointers around.  it may bite in the future.
2021-06-12 10:19:17 +00:00
Omar Polo a6c809551e mention FastCGI in the README.md 2021-06-11 16:11:58 +00:00
Omar Polo fd1ae83d20 fix warnings in manpage
man -Tlint
2021-06-11 16:06:24 +00:00
Omar Polo ada16f8731 document fastcgi and the new `param' options 2021-06-11 16:04:22 +00:00
Omar Polo c92b802b6a add `param' keyword 2021-06-11 15:49:46 +00:00
Omar Polo f740b61b03 more params from and send a custom list 2021-06-11 15:48:56 +00:00
Omar Polo 6957a8c27f reword last sentence 2021-06-04 07:14:50 +00:00
Omar Polo 0c7a1d3cf3 improve docker example 2021-06-04 07:13:37 +00:00
Omar Polo 3a1bd9ab49 sync 2021-05-27 09:46:00 +00:00
Omar Polo f48e3b85a9 move gg to regress 2021-05-24 13:48:55 +00:00
Omar Polo 0d047efcb4 refactor fastcgi block 2021-05-24 09:09:10 +00:00
Omar Polo 8ff40039e8 document `fastcgi' config option 2021-05-24 09:07:28 +00:00
Omar Polo ce2c9edbc2 define and use GMID_VERSION 2021-05-15 11:11:56 +00:00
Omar Polo d1051bfaa0 define some more fcgi param 2021-05-15 11:10:55 +00:00
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