cgi(5)
π cgi β Common Gateway Interface π
okay bestie, so this is cgi(5) from the Programmer's Manual, and it's literally the blueprint for making web pages that do stuff instead of just sitting there. grab a snack, we're going in π
β¨ NAME β¨
cgi β Common Gateway Interface
πΈ DESCRIPTION πΈ
The Common Gateway Interface is a way to create dynamic web pages. no cap, that's the whole glow-up: instead of a static lil file, the page gets built on the fly.
It defines the rules for how a program and the web server talk to each other while the server is talking to the client. it's giving very much a three-way group chat where everyone has their role π
And there are some ways to use it. (yes that's it, that's the sentence, we move.)
π¦ ENVIRONMENT π¦
Normally the webserver sets several environment variables to hand some info over to the CGI program, so the program can figure out various stuff about who's asking and what they want. it's basically the server sliding the CGI program a note under the door π«Ά
AUTH_TYPEβ this reflects the authentification method used to validate a user.CONTENT_LENGTHβ the length of the data in bytes passed to the CGI program through standard input. this one is used by thePOSTmethod.CONTENT_TYPEβ the MIME type of the query data, such as"text/html", optional.DOCUMENT_ROOTβ this reflects the document root directory of the webserver.GATEWAY_INTERFACEβ reflects the version of the Common Gateway Interface that the server is usingHTTP_ACCEPTβ a comma separated list of MIME type that the client is willing to accept.HTTP_FROMβ the email address of the user issuing the information request. > heads up: this is not supported by most browsers, so don't build your whole personality around it πHTTP_REFERERβ reflects the URL from which this CGI program was accessed.HTTP_USER_AGENTβ the name, version and libraries of the browser making the request. you can use this info to work out whether the browser is capable of graphics and is able to display frames and tables. (frames and tablesβ¦ iconic era, honestly π)PATH_INFOβ this shows extra information that was passed to the CGI program via command line. normally it's empty or non-existent.PATH_TRANSLATEDβ the translated path on the local filesystem.QUERY_STRINGβ this variable refers to additional arguments that were appended to the CGI program β normally with the'?'sign.REMOTE_ADDRβ this refers to the host from which the information request was issued, as IP number.REMOTE_HOSTβ this refers to the host from which the information request was issued.REMOTE_USERβ the authenticated name of the user.REQUEST_METHODβ this refers to the method with which the information request was issued. normally this is eitherGETorPOST.SCRIPT_NAMEβ the virtual name of the script being executed.SERVER_NAMEβ the server's hostname or IP number. this may be used to determine the correct paths or resulting HTML code for CGI programs that are used on the same machine for several servers.SERVER_PROTOCOLβ this is the name and version of the information protocol the request came in with. normally this is"HTTP/1.0"or"HTTP/1.1".SERVER_PORTβ this refers to the TCP/IP port on which the webserver is running.SERVER_SOFTWAREβ this reflects the name and revision of the webserver software.
π AUTHOR π
This CGI library is written by Martin Schulze <joey@infodrom.org>. if you have additions or improvements, please get in touch with him β he fr wants to hear from you π
π SEE ALSO π
and that's the whole vibe check, bestie π§ this page came to you from the CGI Library, dated 6 April 2008 β yes it's an elder, but it still ate π β¨
π¦ where this page comes from
- ubuntu jammy: cgilib 0.6-1.1
- Copyright (c) 1998,9,2007,8 by Martin Schulze <joey@infodrom.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms