!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(c) Bjorn Bringert 2006 BSD-styleJohn Chee <cheecheeo@gmail.com> experimental non-portableNone+6 The result of a CGI program.3The value of an input parameter, and some metadata.The input to a CGI action.Environment variables.NInput parameters. For better laziness in reading inputs, this is not a Map.Raw request body. To avoid memory leaks, this is the empty string if the request body has been interpreted as inputs in "application/x-www-form-urlencoded" or "multipart/form-data" format.LRuns a CGI action in a given environment. Uses Handles for input and output.XRuns a CGI action in a given environment. Uses lazy ByteStrings for input and output.SGets and decodes the input according to the request method and the content-type. Builds an  object for a simple value.'The default content-type for variables.BGets the values of all CGI variables from the program environment.Logs some message using the server's logging facility. FIXME: does this have to be more general to support FastCGI etc? Maybe we should store log messages in the CGIState?"Gets inputs from the query string.1Decodes application/x-www-form-urlencoded inputs.>Formats name-value pairs as application/x-www-form-urlencoded. JConverts a single value to the application/x-www-form-urlencoded encoding.!FGets the name-value pairs from application/x-www-form-urlencoded data."OConverts a single value from the application/x-www-form-urlencoded encoding.+Gets input variables from the body, if any.Decodes a POST body.#/Takes the right number of bytes from the input."Decodes multipart/form-data input.$=Replaces all instances of a value in a list by another value.Same as I specialized to strings, but returns the empty string if lookup fails.$ %CGI environment variables, e.g. from .*Handle that input will be read from, e.g. .,Handle that output will be written to, e.g. . CGI actionCGI environment variables. Request body. CGI action.Response (headers and content).CGI environment variables. Request body.VA list of input variables and values, and the request body if it was not interpreted.CGI environment variables.Input variables and values.Input variables and values. !"#CGI environment variables. Request body.dCONTENT_LENGTH bytes from the request body, or the empty string if there is no CONTENT_LENGTH.Content-type parameters Request bodyInput variables and values.$Value to look forValue to replace it with Input list Output list%  !"#$% # !"%$  !"#$%(c) Bjorn Bringert 2006 BSD-styleJohn Chee <cheecheeo@gmail.com> experimental non-portableNone! *+-./02345689:;<=?BCDFGHJKM &The class of CGI monads. Most CGI actions can be run in any monad which is an instance of this class, which means that you can use your own monad transformers to add extra functionality.'Add a response header.(#Get something from the CGI request.)The CGIT monad transformer., A simple CGI monad with just IO.-Run a CGI action..DThrow an exception in a CGI monad. The monad is required to be a , so that we can use  to guarantee ordering./pCatches any expection thrown by a CGI action, and uses the given exception handler if an exception is thrown.0Catches any exception thrown by an CGI action, and returns either the exception, or if no exception was raised, the result of the action.1Deprecated version of /. Use / instead.&'()*+,-./01&'()*+,-./01&'()*+,-./01&'()*+,-./01  Safe-Inferred623456789: 23456789:23456789:@(c) Bjorn Bringert 2004-2005 (c) Ian Lynagh 2005 BSD-styleJohn Chee <cheecheeo@gmail.com> experimentaluportable General server side HTTP cookie library. Based on <http://wp.netscape.com/newsref/std/cookie_spec.html> Safe-Inferred6;:Contains all information about a cookie set by the server.=Name of the cookie.>Value of the cookie.?Expiry date of the cookie. If , the cookie expires when the browser sessions ends. If the date is in the past, the client should delete the cookie immediately.@4The domain suffix to which this cookie will be sent.A+The path to which this cookie will be sent.B: if this cookie should only be sent using secure means.CConstruct a cookie with only name and value set. This client will expire when the browser sessions ends, will only be sent to the server and path which set it and may be sent using any means.D7Get the value of a cookie from a string on the form 7"cookieName1=cookieValue1;...;cookieName2=cookieValue2". This is the format of the Cookie HTTP header.E[Delete a cookie from the client by setting the cookie expiry date to a date in the past.FGShow a cookie on the format used as the value of the Set-Cookie header.Show a name-value pair. FIXME: if the name or value contains semicolons, this breaks. The problem is that the original cookie spec does not mention how to do escaping or quoting.G0Gets all the cookies from a Cookie: header valueReturn H is the list is empty, otherwise return the last element of the list.;<=>?@ABCNameValueCookieD Cookie name,Semicolon separated list of name-value pairsCookie value, if foundE5Cookie to delete. The only fields that matter are =, @ and AFnamevalueGString to parse Cookie name - cookie value pairs ;<=>?@ABCDEFG ;<=>?@ABCDEFG;<=>?@ABCDEFG(c) The University of Glasgow 2001 (c) Bjorn Bringert 2004-2006 (c) Ian Lynagh 2005 (c) Jeremy Shaw 2005 BSD-styleJohn Chee <cheecheeo@gmail.com> experimental'non-portable (uses Control.Monad.State)None6HCompatibility wrapper for the old CGI interface. Output the output from a function from CGI environment and input variables to an HTML document.ICompatibility wrapper for the old CGI interface. Runs a simple CGI server. Note: if using Windows, you might need to wrap   around main.J/Note: if using Windows, you might need to wrap   around main.sReturns the query string, or the request body if it is a POST request, or the empty string if there is an error. HIThe port to run the server on.JCGI environment variables. Request body. Query string. HIJ HIJ HIJ(c) The University of Glasgow 2001 (c) Bjorn Bringert 2004-2006 (c) Ian Lynagh 2005 (c) Jeremy Shaw 2005 BSD-styleJohn Chee <cheecheeo@gmail.com> experimental'non-portable (uses Control.Monad.State)None62KRun a CGI action. Typically called by the main function. Reads input from stdin and writes to stdout. Gets CGI environment variables from the program environment.L Output a {. The output is assumed to be text/html, encoded using ISO-8859-1. To change this, set the Content-type header using ~.M Output a {. The output is assumed to be text/html, encoded using ISO-8859-1. To change this, set the Content-type header using ~.N(Do not output anything (except headers).ORedirect to some location.PCatches any exception thrown by the given CGI action, returns an error page with a 500 Internal Server Error, showing the exception information, and logs the error.Typical usage: ZcgiMain :: CGI CGIResult cgiMain = ... main :: IO () main = runCGI (handleErrors cgiMain)Q?Output a 500 Internal Server Error with information from an .ROutput an error page to the user, with the given HTTP status code in the response. Also logs the error information using .Create an HTML error page.SUse R) to output and log a 404 Not Found error.TUse R2 to output and log a 405 Method Not Allowed error.UUse R/ to output and log a 500 Internal Server Error.V5Get the value of a CGI environment variable. Example: "remoteAddr <- getVar "REMOTE_ADDR"X3Get all CGI environment variables and their values.Y_The server's hostname, DNS alias, or IP address as it would appear in self-referencing URLs.Z.The port number to which the request was sent.[]The method with which the request was made. For HTTP, this is "GET", "HEAD", "POST", etc.\The extra path information, as given by the client. This is any part of the request path that follows the CGI program path. If the string returned by this function is not empty, it is guaranteed to start with a '/'.Note that this function returns an unencoded string. Make sure to percent-encode any characters that are not allowed in URI paths before using the result of this function to construct a URI. See k, l and m for a higher-level interface.]The path returned by \8, but with virtual-to-physical mapping applied to it.^MA virtual path to the script being executed, used for self-referencing URIs.Note that this function returns an unencoded string. Make sure to percent-encode any characters that are not allowed in URI paths before using the result of this function to construct a URI. See k, l and m for a higher-level interface._The information which follows the ? in the URL which referenced this program. This is the percent-encoded query information. For most normal uses, n- and friends are probably more convenient.`pThe hostname making the request. If the server does not have this information, Nothing is returned. See also a.a5The IP address of the remote host making the request.bIf the server supports user authentication, and the script is protected, this is the protocol-specific authentication method used to validate the user.c|If the server supports user authentication, and the script is protected, this is the username they have authenticated as.dFor queries which have attached information, such as HTTP POST and PUT, this is the content type of the data. You can use E to get a structured representation of the the content-type value.eFor queries which have attached information, such as HTTP POST and PUT, this is the length of the content given by the client.fmGets the value of the request header with the given name. The header name is case-insensitive. Example: requestHeader "User-Agent"kAttempts to reconstruct the absolute URI of this program. This does not include any extra path information or query parameters. See l for that. If the server is rewriting request URIs, this URI can be different from the one requested by the client. See also m.ZCharacters in the components of the returned URI are escaped when needed, as required by  Network.URI.lLike k, but the returned  also includes any extra path information, and any query parameters. If the server is rewriting request URIs, this URI can be different from the one requested by the client. See also m.ZCharacters in the components of the returned URI are escaped when needed, as required by  Network.URI.8Does percent-encoding as needed for URI path components.m/Attempts to reconstruct the absolute URI requested by the client, including extra path information and query parameters. If no request URI rewriting is done, or if the web server does not provide the information needed to reconstruct the request URI, this function returns the same value as l.ZCharacters in the components of the returned URI are escaped when needed, as required by  Network.URI.nGet the value of an input variable, for example from a form. If the variable has multiple values, the first one is returned. Example: query <- getInput "query"oLike n, but returns a .pGet all the values of an input variable, for example from a form. This can be used to get all the values from form controls which allow multiple values to be selected. Example: %vals <- getMultiInput "my_checkboxes"qSame as p but using s.rGet the file name of an input.sGet the content-type of an input, if the input exists, e.g. "image/jpeg". For non-file inputs, this function returns "text/plain". You can use E to get a structured representation of the the content-type value.tSame as n2, but tries to read the value to the desired type.uGet the names and values of all inputs. Note: the same name may occur more than once in the output, if there are several values for the name.vGet the names and values of all inputs. Note: the same name may occur more than once in the output, if there are several values for the name.w%Get the names of all input variables.x.Get the uninterpreted request body as a Stringy5Get the uninterpreted request body as lazy ByteStringzGet the value of a cookie.{Same as z2, but tries to read the value to the desired type.| Set a cookie.}Delete a cookie from the client~"Add a response header. Example: %setHeader "Content-type" "text/plain"Set the HTTP response status.:KLThe string to output.MThe string to output.NOA URL to redirect to.PQRHTTP Status codeStatus messageError information Status codeStatus messageError information Status codeStatus messageError informationS#The name of the requested resource.TThe allowed methods.UError information.VThe name of the variable.WThe name of the variable. Default valueXYZ[\]^_`abcdefghijklmnThe name of the variable.<The value of the variable, or Nothing, if it was not set.oThe name of the variable.<The value of the variable, or Nothing, if it was not set.pThe name of the variable.KThe values of the variable, or the empty list if the variable was not set.qThe name of the variable.KThe values of the variable, or the empty list if the variable was not set.rThe name of the variable.;The file name corresponding to the input, if there is one.sThe name of the variable.(The content type, formatted as a string.tThe name of the variable.c if the variable does not exist or if the value could not be interpreted at the desired type.uvwxyzThe name of the cookie. if the cookie does not exist.{The name of the cookie.a if the cookie does not exist or if the value could not be interpreted at the desired type.|}~ Header name. Header value.HTTP status code, e.g. 404HTTP status message, e.g.  "Not Found"a  !"&),./0123456789:;<=>?@ABCHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~^&) ,K./01PLMNO~RQSTUnotxyuvwpqrsVWXYZ[\]^_`abcdefklm89674523ghij: ;<=>?@ABCz{|} !":KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    !"#$$%&'()*+,-./01234567789:;<=> ? ? @ @ A A B C DEEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~N  C cgi-3001.2.2.0 Network.CGINetwork.CGI.ProtocolNetwork.CGI.CompatNetwork.CGI.MonadNetwork.CGI.Cookie System.IOstdinstdoutNetwork.CGI.AcceptNetwork withSocketsDotransformers-0.4.1.0Control.Monad.IO.ClassMonadIOliftIOmultipart-0.1.2Network.Multipart.HeadershowContentTypeparseContentTypeHeaders HeaderName ctParameters ctSubtypectType ContentTypexhtml-3000.2.1Text.XHtml.InternalsHtml CGIResult CGINothing CGIOutputInput inputValue inputFilenameinputContentType CGIRequestcgiVars cgiInputscgiRequestBodyhRunCGI runCGIEnvFPS decodeInput getCGIVarslogCGI formEncode urlEncode formDecode urlDecode takeInputreplace maybeReadMonadCGI cgiAddHeadercgiGetCGITunCGITCGIrunCGITthrowCGIcatchCGItryCGIhandleExceptionCGILanguageContentEncodingCharset AcceptableAccept negotiateCookie cookieName cookieValue cookieExpires cookieDomain cookiePath cookieSecure newCookie findCookie deleteCookie showCookie readCookieswrapperpwrapperconnectToCGIScriptrunCGIoutput outputFPS outputNothingredirect handleErrorsoutputException outputErroroutputNotFoundoutputMethodNotAllowedoutputInternalServerErrorgetVargetVarWithDefaultgetVars serverName serverPort requestMethodpathInfopathTranslated scriptName queryString remoteHost remoteAddrauthType remoteUserrequestContentTyperequestContentLength requestHeader requestAcceptrequestAcceptCharsetrequestAcceptEncodingrequestAcceptLanguageprogURIqueryURI requestURIgetInput getInputFPS getMultiInputgetMultiInputFPSgetInputFilenamegetInputContentType readInput getInputs getInputsFPS getInputNamesgetBody getBodyFPS getCookie readCookie setCookie setHeader setStatus simpleInputdefaultInputType queryInput formInput bodyInput decodeBodymultipartDecode lookupOrNilbaseGHC.ListlookupformatResponsedefaultContentTypebodyPartToInputexceptions-0.6.1Control.Monad.Catch MonadThrowthrowM$fMonadErrorSomeExceptionCGIT$fMonadTransCGIT$fMonadCGICGIT$fMonadMaskCGIT$fMonadCatchCGIT$fMonadThrowCGIT $fMonadIOCGIT $fMonadCGIT$fApplicativeCGIT $fFunctorCGITincludestopQuality starOrEqualToqualitycompareSpecificity hasParameter$fAcceptableLanguage$fHeaderValueLanguage $fOrdLanguage $fEqLanguage$fAcceptableContentEncoding$fHeaderValueContentEncoding$fOrdContentEncoding$fEqContentEncoding$fAcceptableCharset$fHeaderValueCharset $fOrdCharset $fEqCharset$fAcceptableContentType$fHeaderValueAccept Data.MaybeNothingghc-prim GHC.TypesTrueshowPair maybeLastgetRequestInputacceptConnectionsaccept'runabortsendBackGHC.BaseStringbytestring-0.10.4.0Data.ByteString.Lazy.Internal ByteString GHC.Exception Exception errorPagenetwork-uri-2.6.0.1 Network.URIURI escapePath errorTextrequestHeaderValue getInput_