Annotation of embedaddon/lighttpd/tests/fcgi-auth.c, revision 1.1.1.1

1.1       misho       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>