changeset 4:936ca775f4b8

daemon: spawn a SCGI listener Currently, the handler doesn't do anything interesting. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 27 Jul 2017 01:37:12 +0300
parents 545cda697d7a
children d318c6946e49
files daemon.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/daemon.c	Thu Jul 27 01:33:39 2017 +0300
+++ b/daemon.c	Thu Jul 27 01:37:12 2017 +0300
@@ -26,10 +26,19 @@
 #include <jeffpc/version.h>
 #include <jeffpc/error.h>
 #include <jeffpc/types.h>
+#include <jeffpc/scgisvc.h>
 
 #include "config.h"
 #include "version.h"
 
+static void process_request(struct scgi *scgi, void *private)
+{
+	cmn_err(CE_ERROR, "%s is a no-op", __func__);
+
+	scgi->response.body = "no-op";
+	scgi->response.bodylen = strlen(scgi->response.body);
+}
+
 static int drop_privs()
 {
 	static const char *privs[] = {
@@ -96,6 +105,11 @@
 	if (ret)
 		goto err;
 
+	ret = scgisvc(NULL, config.scgi_port, config.scgi_threads,
+		      process_request, NULL);
+	if (ret)
+		goto err;
+
 	return 0;
 
 err: