File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / lighttpd / tests / fcgi-auth.c
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 10:32:47 2013 UTC (10 years, 9 months ago) by misho
CVS tags: MAIN, HEAD
Initial revision

    1: #ifdef HAVE_CONFIG_H
    2: #include "config.h"
    3: #endif
    4: #ifdef HAVE_FASTCGI_FASTCGI_H
    5: #include <fastcgi/fcgi_stdio.h>
    6: #else
    7: #include <fcgi_stdio.h>
    8: #endif
    9: #include <stdlib.h>
   10: #include <unistd.h>
   11: #include <string.h>
   12: 
   13: int main (void) {
   14: 	char* p;
   15: 
   16: 	while (FCGI_Accept() >= 0) {
   17: 		/* wait for fastcgi authorizer request */
   18: 
   19: 		printf("Content-type: text/html\r\n");
   20: 
   21: 		if (((p = getenv("QUERY_STRING")) == NULL) ||
   22: 		    strcmp(p, "ok") != 0) {
   23: 			printf("Status: 403 Forbidden\r\n\r\n");
   24: 		} else {
   25: 			printf("\r\n");
   26: 			/* default Status is 200 - allow access */
   27: 		}
   28: 
   29: 		printf("foobar\r\n");
   30: 	}
   31: 
   32: 	return 0;
   33: }

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