Blob
- Date:
- Message:
- fastcgi: a first implementation Not production-ready yet, but it's a start. This adds a third ``backend'' for gmid: until now there it served local files or CGI scripts, now FastCGI applications too. FastCGI is meant to be an improvement over CGI: instead of exec'ing a script for every request, it allows to open a single connection to an ``application'' and send the requests/receive the responses over that socket using a simple binary protocol. At the moment gmid supports three different methods of opening a fastcgi connection: - local unix sockets, with: fastcgi "/path/to/sock" - network sockets, with: fastcgi tcp "host" [port] port defaults to 9000 and can be either a string or a number - subprocess, with: fastcgi spawn "/path/to/program" the fastcgi protocol is done over the executed program stdin of these, the last is only for testing and may be removed in the future. P.S.: the fastcgi rule is per-location of course :)
- Actions:
- History | Blame | Raw File
1 /* -*- mode: fundamental; indent-tabs-mode: t; -*- */2 %{4 /*5 * Copyright (c) 2021 Omar Polo <op@omarpolo.com>6 *7 * Permission to use, copy, modify, and distribute this software for any8 * purpose with or without fee is hereby granted, provided that the above9 * copyright notice and this permission notice appear in all copies.10 *11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.18 */20 #include <err.h>21 #include <errno.h>23 #include "gmid.h"25 #include "y.tab.h"27 %}29 %x COMMENT30 %x STRING32 %%34 <INITIAL># BEGIN(COMMENT);35 <COMMENT>.*\n yylineno++; BEGIN(INITIAL);37 <INITIAL>\" BEGIN(STRING);38 <STRING>[^"]*\" {39 if ((yylval.str = strdup(yytext)) == NULL)40 err(1, "strdup");41 yylval.str[strlen(yylval.str)-1] = '\0'; /* remove the closing quote */42 BEGIN(INITIAL);43 return TSTRING;44 }46 [0-9]+ {47 yylval.num = parse_portno(yytext);48 return TNUM;49 }51 off yylval.num = 0; return TBOOL;52 on yylval.num = 1; return TBOOL;54 alias return TALIAS;55 auto return TAUTO;56 block return TBLOCK;57 ca return TCA;58 cert return TCERT;59 cgi return TCGI;60 chroot return TCHROOT;61 client return TCLIENT;62 default return TDEFAULT;63 entrypoint return TENTRYPOINT;64 env return TENV;65 fastcgi return TFASTCGI;66 index return TINDEX;67 ipv6 return TIPV6;68 key return TKEY;69 lang return TLANG;70 location return TLOCATION;71 log return TLOG;72 mime return TMIME;73 port return TPORT;74 prefork return TPREFORK;75 protocols return TPROTOCOLS;76 require return TREQUIRE;77 return return TRETURN;78 root return TROOT;79 server return TSERVER;80 spawn return TSPAWN;81 strip return TSTRIP;82 tcp return TTCP;83 type return TTYPE;84 user return TUSER;86 [{}] return *yytext;88 \n yylineno++;90 [ \f\r\t\v]+ ;92 . yyerror("unexpected character: %c", *yytext); exit(1);94 %%96 int97 yywrap(void)98 {99 return 1;100 }