From 747cd86e65c41a3ed13403205bf80da892e1f43f Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Wed, 7 Nov 2012 18:45:42 -0700 Subject: [PATCH] Remove -a option, add contrib directory There wasn't actually any authentication code in eris.c. I'll add it back in if anybody asks. --- contrib/README | 9 +++++++++ contrib/g.cgi.c | 31 +++++++++++++++++++++++++++++++ eris.c | 7 +------ 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 contrib/README create mode 100644 contrib/g.cgi.c diff --git a/contrib/README b/contrib/README new file mode 100644 index 0000000..bdcc8a1 --- /dev/null +++ b/contrib/README @@ -0,0 +1,9 @@ +This directory contains little wrappers to help make your life +running a full Internet-facing web server (such as woozle.org) +a little easier. + +Quite a lot of web software these days is written to work with +Apache and nothing else. PHP is a notable example: even PHP-CGI, +as shipped on Debian, requires special environment variables that +only Apache sets, and doesn't work with eg. mathopd, boa, busybox +httpd, or eris. diff --git a/contrib/g.cgi.c b/contrib/g.cgi.c new file mode 100644 index 0000000..0e885e0 --- /dev/null +++ b/contrib/g.cgi.c @@ -0,0 +1,31 @@ +/** g.cgi - CGI interface to cgit and git-http-backend + * + * This is a simple CGI to invoke cgit with a configuration + * file of your choice. It will also invoke git-http-backend + * if appropriate, which in my (very light) testing runs about + * twice as fast as plain HTTP with git-update-server-info. + */ +#include +#include +#include + +/* Set these to appropriate paths */ +#define CGIT_CONFIG "/home/neale/public_html/cgitrc" +#define GIT_PROJECT_ROOT "/home/neale/projects" + +int +main(int argc, char *argv[]) +{ + char *uri = getenv("REQUEST_URI"); + + if (uri && strstr(uri, "git-upload-pack")) { + /* Use git-http-backend for great speed! */ + setenv("GIT_PROJECT_ROOT", GIT_PROJECT_ROOT, 1); + execlp("git", "git", "http-backend", NULL); + } else { + setenv("CGIT_CONFIG", CGIT_CONFIG, 1); + execlp("cgit", "cgit", NULL); + } + + return 0; +} diff --git a/eris.c b/eris.c index 1e6ef34..3c77310 100644 --- a/eris.c +++ b/eris.c @@ -79,7 +79,6 @@ /* * Options */ -int doauth = 0; int docgi = 0; int doidx = 0; int nochdir = 0; @@ -245,11 +244,8 @@ parse_options(int argc, char *argv[]) { int opt; - while (-1 != (opt = getopt(argc, argv, "acdhkprv."))) { + while (-1 != (opt = getopt(argc, argv, "cdhkprv."))) { switch (opt) { - case 'a': - doauth = 1; - break; case 'c': docgi = 1; break; @@ -273,7 +269,6 @@ parse_options(int argc, char *argv[]) fprintf(stderr, "Usage: %s [OPTIONS]\n", argv[0]); fprintf(stderr, "\n"); - fprintf(stderr, "-a Enable authentication\n"); fprintf(stderr, "-c Enable CGI\n"); fprintf(stderr, "-d Enable directory listing\n"); fprintf(stderr, "-. Serve out of ./ (no vhosting)\n");