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.
This commit is contained in:
Neale Pickett 2012-11-07 18:45:42 -07:00
parent c73f0b6d0d
commit 747cd86e65
3 changed files with 41 additions and 6 deletions

9
contrib/README Normal file
View File

@ -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.

31
contrib/g.cgi.c Normal file
View File

@ -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 <string.h>
#include <stdlib.h>
#include <unistd.h>
/* 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;
}

7
eris.c
View File

@ -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");