!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ non-portable experimental Anders Kaseorg <andersk@mit.edu> Safe-InferedA MIME media type value.  The $ instance is derived automatically.  Use   to obtain the standard  string representation.  See  #http://www.ietf.org/rfc/rfc2046.txt for more ' information about MIME media types. +The top-level media type, the general type $ of the data. Common examples are  "text", "image", "audio", "video",  " multipart", and " application". -The media subtype, the specific data format.  Examples include "plain", "html",  "jpeg", " form-data", etc. ,Media type parameters. On common example is ! the charset parameter for the "text"  top-level type, e.g. ("charset"," ISO-8859-1"). 9A string with case insensitive equality and comparisons. HTTP headers. 5Parse the standard representation of a content-type. 6 If the input cannot be parsed, this function calls  / with a (hopefully) informative error message. RFC 822 LWSP-char "    non-portable experimental Anders Kaseorg <andersk@mit.edu> Safe-Infered!Read a multi-part message from a . !Read a multi-part message from a .  Fails on parse errors.  Boundary  Boundary   non-portable experimental Anders Kaseorg <andersk@mit.edu> Safe-Infered The result of a CGI program. 4The value of an input parameter, and some metadata. The input to a CGI action. Environment variables. 9Input parameters. For better laziness in reading inputs,  this is not a Map. )Raw request body. To avoid memory leaks, 7 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. NRuns a CGI action in a given environment. Uses Handles for input and output. ARuns a CGI action in a given environment. Uses lazy ByteStrings  for input and output. 4Gets and decodes the input according to the request  method and the content-type. CGets the values of all CGI variables from the program environment. "Logs some message using the server's logging facility. 5 FIXME: does this have to be more general to support 8 FastCGI etc? Maybe we should store log messages in the  CGIState? 'Formats name-value pairs as application/x-www-form-urlencoded. *Converts a single value to the application/ x-www-form-urlencoded encoding. !*Gets the name-value pairs from application/x-www-form-urlencoded data. ""Converts a single value from the  application/ x-www-form-urlencoded encoding. #0Takes the right number of bytes from the input. $>Replaces all instances of a value in a list by another value.  %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 action CGI environment variables. Request body.  CGI action.  Response (headers and content). CGI environment variables. Request body. ;A list of input variables and values, and the request body  if it was not interpreted.  !"#CGI environment variables. Request body. 'CONTENT_LENGTH bytes from the request , body, or the empty string if there is no  CONTENT_LENGTH. $Value to look for Value to replace it with  Input list  Output list %  !"#$%   # !"%$  !"#$% non-portable experimental Anders Kaseorg <andersk@mit.edu>None &8The class of CGI monads. Most CGI actions can be run in B any monad which is an instance of this class, which means that G 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. .?Throw an exception in a CGI monad. The monad is required to be  a , so that we can use  to guarantee ordering. /BCatches any expection thrown by a CGI action, and uses the given 0 exception handler if an exception is thrown. 0BCatches any exception thrown by an CGI action, and returns either K the exception, or if no exception was raised, the result of the action. 1Deprecated version of /. Use / instead. &'()*+,-./01&'()*+,-./01&'()*+,-./01&'()*+,-./01  Safe-Infered23456789: 23456789:23456789:uportable General server side HTTP cookie library. Based on <http://wp.netscape.com/newsref/std/cookie_spec.html> experimental Anders Kaseorg <andersk@mit.edu> Safe-Infered ;;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 2 cookie expires when the browser sessions ends. 1 If the date is in the past, the client should " delete the cookie immediately. @5The 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. C1Construct a cookie with only name and value set. ; This client will expire when the browser sessions ends, 9 will only be sent to the server and path which set it $ and may be sent using any means. D4Get the value of a cookie from a string on the form  "5cookieName1=cookieValue1;...;cookieName2=cookieValue2".  This is the format of the Cookie HTTP header. EBDelete a cookie from the client by setting the cookie expiry date  to a date in the past. FHShow a cookie on the format used as the value of the Set-Cookie header. G1Gets all the cookies from a Cookie: header value ;<=>?@ABCName Value Cookie D Cookie name -Semicolon separated list of name-value pairs Cookie value, if found E.Cookie to delete. The only fields that matter  are =, @ and A FGString to parse !Cookie name - cookie value pairs ;<=>?@ABCDEFG ;<=>?@ABCDEFG;<=>?@ABCDEFG'non-portable (uses Control.Monad.State) experimental Anders Kaseorg <andersk@mit.edu> Safe-InferedH1Compatibility wrapper for the old CGI interface. > Output the output from a function from CGI environment and ( input variables to an HTML document. I1Compatibility wrapper for the old CGI interface.  Runs a simple CGI server. 2 Note: if using Windows, you might need to wrap   around main. J/Note: if using Windows, you might need to wrap   around main. HIThe port to run the server on. JHIJHIJHIJ'non-portable (uses Control.Monad.State) experimental Anders Kaseorg <andersk@mit.edu>None0K9Run a CGI action. Typically called by the main function. 5 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 A ISO-8859-1. To change this, set the Content-type header using  ~. M Output a ". The output is assumed to be text/html, 6 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. P6Catches 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:  cgiMain :: CGI CGIResult  cgiMain = ...   main :: IO () & main = runCGI (handleErrors cgiMain) Q9Output a 500 Internal Server Error with information from  an . R1Output an error page to the user, with the given E HTTP status code in the response. Also logs the error information  using . SUse R* to output and log a 404 Not Found error. TUse R3 to output and log a 405 Method Not Allowed error. UUse R0 to output and log a 500 Internal Server Error. V6Get the value of a CGI environment variable. Example: $ remoteAddr <- getVar "REMOTE_ADDR" X4Get all CGI environment variables and their values. Y The server'2s 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. \4The extra path information, as given by the client. 9 This is any part of the request path that follows the  CGI program path. 9 If the string returned by this function is not empty, $ it is guaranteed to start with a '/'. 5Note 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 \, but with virtual-to-physical  mapping applied to it. ^/A virtual path to the script being executed, " used for self-referencing URIs. 5Note 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. _AThe 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. `=The hostname making the request. If the server does not have 3 this information, Nothing is returned. See also a. a6The IP address of the remote host making the request. b?If the server supports user authentication, and the script is A 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. d6For queries which have attached information, such as < HTTP POST and PUT, this is the content type of the data.  You can use   to get a structured 1 representation of the the content-type value. e6For queries which have attached information, such as 9 HTTP POST and PUT, this is the length of the content  given by the client. f:Gets the value of the request header with the given name. ( The header name is case-insensitive.  Example:  requestHeader "User-Agent" k;Attempts to reconstruct the absolute URI of this program.  This does not include 7 any extra path information or query parameters. See  l for that. 9 If the server is rewriting request URIs, this URI can 6 be different from the one requested by the client.  See also m. >Characters in the components of the returned URI are escaped  when needed, as required by  Network.URI. lLike k, but the returned  also includes 9 any extra path information, and any query parameters. 9 If the server is rewriting request URIs, this URI can 6 be different from the one requested by the client.  See also m. >Characters in the components of the returned URI are escaped  when needed, as required by  Network.URI. mBAttempts to reconstruct the absolute URI requested by the client, : including extra path information and query parameters. F If no request URI rewriting is done, or if the web server does not B provide the information needed to reconstruct the request URI, + this function returns the same value as l. >Characters in the components of the returned URI are escaped  when needed, as required by  Network.URI. n=Get the value of an input variable, for example from a form. C If the variable has multiple values, the first one is returned.  Example:  query <- getInput "query" oLike n, but returns a . pBGet 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. s<Get 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   to get a structured 1 representation of the the content-type value. tSame as n3, but tries to read the value to the desired type. u(Get 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. v(Get 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 String y6Get the uninterpreted request body as lazy ByteString zGet the value of a cookie. {Same as z3, 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. 5KLThe string to output. MThe string to output. NOA URL to redirect to. PQRHTTP Status code Status message Error information S$The name of the requested resource. TThe allowed methods. UError information. VThe name of the variable. WThe name of the variable. Default value XYZ[\]^_`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. The values of the variable, 0 or the empty list if the variable was not set. qThe name of the variable. The values of the variable, 0 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.  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.  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. 404 HTTP status message, e.g.  Not Found a  !"&),./0123456789:;<=>?@ABCHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~^&) ,K./01PLMNO~RQSTUnotxyuvwpqrsVWXYZ[\]^_`abcdefklm89674523ghij: ;<=>?@ABCz{|} !"5KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  !"#$$%&'()*+,-./01234567789:;<=> ? ? @ @ A A B C DEEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~N cgi-3001.1.8.2 Network.CGINetwork.CGI.CompatNetwork.CGI.ProtocolNetwork.CGI.MonadNetwork.CGI.CookieNetwork.CGI.HeaderNetwork.CGI.Multipart System.IOstdinstdoutNetwork.CGI.AcceptNetwork withSocketsDotransformers-0.2.2.0Control.Monad.IO.ClassMonadIOliftIOxhtml-3000.2.0.5Text.XHtml.InternalsHtml ContentTypectType ctSubtype ctParameters HeaderNameHeadersparseContentTypeshowContentType 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 setStatusbaseGHC.ShowShowGHC.Basefailws1ContentDispositionContentTransferEncoding HeaderValueparseHeaderValueprettyHeaderValuepHeadersgetContentTypegetContentTransferEncodinggetContentDispositionparseMcaseInsensitiveEqcaseInsensitiveComparelexemep_token$fHeaderValueContentDisposition$$fHeaderValueContentTransferEncoding$fHeaderValueContentType$fOrdContentType$fEqContentType$fOrdHeaderName$fEqHeaderNameparseMultipartBodybytestring-0.9.2.1Data.ByteString.Lazy.Internal ByteStringhGetMultipartBodyGHC.IO.Handle.TypesHandleBodyPart MultiPartshowMultipartBody$fTypeableCGIResultGHC.IOthrowIO$fMonadErrorSomeExceptionCGIT$fMonadTransCGIT$fMonadCGICGIT$fMonadCatchIOCGIT $fMonadIOCGIT $fMonadCGIT $fFunctorCGIT$fTypeableCGIT$fAcceptableLanguage$fHeaderValueLanguage $fOrdLanguage $fEqLanguage$fAcceptableContentEncoding$fHeaderValueContentEncoding$fOrdContentEncoding$fEqContentEncoding$fAcceptableCharset$fHeaderValueCharset $fOrdCharset $fEqCharset$fAcceptableContentType$fHeaderValueAccept Data.MaybeNothingghc-prim GHC.TypesTrueString GHC.Exception Exceptionnetwork-2.3.0.10 Network.URIURI