File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / lighttpd / tests / fcgi-auth.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 10:32:47 2013 UTC (10 years, 8 months ago) by misho
Branches: lighttpd, MAIN
CVS tags: v1_4_41p8, v1_4_35p0, v1_4_35, v1_4_33, HEAD
1.4.33

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_FASTCGI_FASTCGI_H
#include <fastcgi/fcgi_stdio.h>
#else
#include <fcgi_stdio.h>
#endif
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

int main (void) {
	char* p;

	while (FCGI_Accept() >= 0) {
		/* wait for fastcgi authorizer request */

		printf("Content-type: text/html\r\n");

		if (((p = getenv("QUERY_STRING")) == NULL) ||
		    strcmp(p, "ok") != 0) {
			printf("Status: 403 Forbidden\r\n\r\n");
		} else {
			printf("\r\n");
			/* default Status is 200 - allow access */
		}

		printf("foobar\r\n");
	}

	return 0;
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>