SEANK.H.LIAO

common gateway interface

notes on cgi things

common gateway interface

So how do programs of yore run as web servers when they didn't include a http stack? You run a dedicated server process (Apache, Nginx, ...) which calls your program to generate the response.

CGI

rfc3875

The oldest protocol. The server executes a program, passing request info as env and request body as stdin, expecting a response (including headers) on stdout.

FCGI

spec

FastCGI, because fork-exec for every request is too costly. Basically a worker pool of processes that are kept alive, communication (request,response) is over sockets

SCGI

spec

SimpleCGI, like FCGI but simpler(?) to parse

uwsgi

spec

Not to be confused with the framework of the same name, a simplish binary packet protocol for between the server and framework.

JServ

spec

Binary packet protocol between web server and application thing.

Language Specific

There are others, like for Perl, Clojure, Common Lisp, ...

JavaScript JSGI

javascript object as request, javascript object as response.

Python WSGI

Web Server Gateway Interface, Python specific. The python function signature: request as env/dict, response through callback/return string. Uses a separate middleware process to manage lifetimes and translate from HTTP/other to the function call. Example: Apache <-HTTP-> uwsgi <-function call-> app