"Fossies" - the Fresh Open Source Software Archive

Member "lighttpd-1.4.54/tests/fcgi-auth.c" (27 May 2019, 618 Bytes) of package /linux/www/lighttpd-1.4.54.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 <string.h>
   11 
   12 int main (void) {
   13 
   14     while (FCGI_Accept() >= 0) {
   15 
   16         /* Status: 200 OK to allow access is implied
   17          * if Status header is not included in response */
   18 
   19         char *p = getenv("QUERY_STRING");
   20         if (p != NULL && 0 == strcmp(p, "var")) {
   21             printf("Variable-X-LIGHTTPD-FCGI-AUTH: LighttpdTestContent\r\n");
   22         } else if (p == NULL || 0 != strcmp(p, "ok")) {
   23             printf("Status: 403 Forbidden\r\n");
   24         }
   25 
   26         printf("\r\n");
   27     }
   28 
   29     return 0;
   30 }