úÎöö쟔      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“(c) Bjorn Bringert 2006 BSD-styleJohn Chee <cheecheeo@gmail.com> experimental non-portableSafe0<= 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! /023459:;<=?@ABCDFIJKMNOQRT ,À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.2 A simple CGI monad with just IO.3Run a CGI action.4DThrow an exception in a CGI monad. The monad is required to be a  , so that we can use ¡ to guarantee ordering.5pCatches any expection thrown by a CGI action, and uses the given exception handler if an exception is thrown.6ŒCatches any exception thrown by an CGI action, and returns either the exception, or if no exception was raised, the result of the action.7Deprecated version of 5. Use 5 instead.,-./0123456789:;<=>?@A,-./01234567,-./01234567,-./0123456789:;<=>?@A@(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<=B:Contains all information about a cookie set by the server.DName of the cookie.EValue of the cookie.FExpiry 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.G4The domain suffix to which this cookie will be sent.H+The path to which this cookie will be sent.I£: if this cookie should only be sent using secure means.JÈConstruct 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.K7Get 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.L[Delete a cookie from the client by setting the cookie expiry date to a date in the past.MGShow 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.N0Gets all the cookies from a Cookie: header value¥Return ¢H is the list is empty, otherwise return the last element of the list.BCDEFGHIJNameValueCookieK Cookie name,Semicolon separated list of name-value pairsCookie value, if foundL5Cookie to delete. The only fields that matter are D, G and HM¤namevalueNString to parse Cookie name - cookie value pairs¥ BCDEFGHIJKLMN BCDEFGHIJKLMNBCDEFGHIJKLM¤N¥˜(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)None<=S–Compatibility wrapper for the old CGI interface. Output the output from a function from CGI environment and input variables to an HTML document.T€Compatibility wrapper for the old CGI interface. Runs a simple CGI server. Note: if using Windows, you might need to wrap   around main.U/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. STThe port to run the server on.§¨©U¦CGI environment variables. Request body. Query string.ª« STU STU ST§¨©U¦ª« Safe<=VWXYZ[\¬­®]¯°^±²³´µ¶·¸¹º»¼½¾¿ÀÁ VWXYZ[\]^VWXYZ[\¬­®]¯°^±²³´µ¶·¸¹º»¼½¾¿ÀÁ˜(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)None<=2_¨Run 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.` Output a Â{. The output is assumed to be text/html, encoded using ISO-8859-1. To change this, set the Content-type header using ’.a Output a Ã{. The output is assumed to be text/html, encoded using ISO-8859-1. To change this, set the Content-type header using ’.b(Do not output anything (except headers).cRedirect to some location.dªCatches 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)e?Output a 500 Internal Server Error with information from an Ä.fOutput 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.gUse f) to output and log a 404 Not Found error.hUse f2 to output and log a 405 Method Not Allowed error.iUse f/ to output and log a 500 Internal Server Error.j5Get the value of a CGI environment variable. Example: "remoteAddr <- getVar "REMOTE_ADDR"l3Get all CGI environment variables and their values.m_The server's hostname, DNS alias, or IP address as it would appear in self-referencing URLs.n.The port number to which the request was sent.o]The method with which the request was made. For HTTP, this is "GET", "HEAD", "POST", etc.pß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 , € and  for a higher-level interface.qThe path returned by p8, but with virtual-to-physical mapping applied to it.rMA 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 , € and  for a higher-level interface.s™The information which follows the ? in the URL which referenced this program. This is the percent-encoded query information. For most normal uses, ‚- and friends are probably more convenient.tpThe hostname making the request. If the server does not have this information, Nothing is returned. See also u.u5The IP address of the remote host making the request.v™If the server supports user authentication, and the script is protected, this is the protocol-specific authentication method used to validate the user.w|If the server supports user authentication, and the script is protected, this is the username they have authenticated as.x€For 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.y„For queries which have attached information, such as HTTP POST and PUT, this is the length of the content given by the client.zmGets the value of the request header with the given name. The header name is case-insensitive. Example: requestHeader "User-Agent"Attempts to reconstruct the absolute URI of this program. This does not include any extra path information or query parameters. See €† for that. If the server is rewriting request URIs, this URI can be different from the one requested by the client. See also .ZCharacters in the components of the returned URI are escaped when needed, as required by  Network.URI.€Like , 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 .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.ÿ/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 €.ZCharacters in the components of the returned URI are escaped when needed, as required by  Network.URI.‚‹Get 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"ƒLike ‚, but returns a Ã.„³Get 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"…Same as „ but using Ãs.†Get the file name of an input.‡•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 E to get a structured representation of the the content-type value.ˆSame as ‚2, but tries to read the value to the desired type.‰“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.Š“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.‹%Get the names of all input variables.Œ.Get the uninterpreted request body as a String5Get the uninterpreted request body as lazy ByteStringŽGet the value of a cookie.Same as Ž2, 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.:_`The string to output.aThe string to output.bcA URL to redirect to.defHTTP Status codeStatus messageError informationÅ Status codeStatus messageError informationÈ Status codeStatus messageError informationg#The name of the requested resource.hThe allowed methods.iError information.jThe name of the variable.kThe name of the variable. Default valuelmnopqrstuvwxyzÉ{|}~€Ç‚The name of the variable.<The value of the variable, or Nothing, if it was not set.ƒThe name of the variable.<The value of the variable, or Nothing, if it was not set.„The name of the variable.KThe values of the variable, or the empty list if the variable was not set.…The name of the variable.KThe values of the variable, or the empty list if the variable was not set.†The name of the variable.;The file name corresponding to the input, if there is one.‡The name of the variable.(The content type, formatted as a string.ˆThe name of the variable.¢c if the variable does not exist or if the value could not be interpreted at the desired type.‰Š‹ÊŒŽThe 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   !",/24567BCDEFGHIJSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“^,/ 2_4567d`abc’“feghi‚ƒˆŒ‰Š‹„…†‡jklmnopqrstuvwxyz€\]Z[XYVW{|}~^ BCDEFGHIJŽ‘ !":_`abcdefÅÈghijklmnopqrstuvwxyzÉ{|}~€Ç‚ƒ„…†‡ˆ‰Š‹ÊŒŽ‘’“Ë    !"#$$%&'()*+,-./0123456789:;<==>?@ABCDEFGHIJKLMNOOPQRSTUVWXYZ[\]^_`a b b c c d d e f ghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™Xš›œžŸ ¡¢£ ¤¥¦§¨©ª«©ª¬ ­®¯°±²³´µ¶·¸¹ º » ¼ f ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î ­ÏÐÑÒ ÓÔÕÖרÙÚÛÜÝ%cgi-3001.2.2.3-Fc2VNgEHD5O9w4p5omil3i Network.CGINetwork.CGI.ProtocolNetwork.CGI.CompatNetwork.CGI.MonadNetwork.CGI.Cookie System.IOstdinstdoutNetwork withSocketsDoNetwork.CGI.AcceptbaseControl.Monad.IO.ClassliftIOMonadIO&multipart-0.1.2-6gTlfshYeN9D1beoXxTayVNetwork.Multipart.HeadershowContentTypeparseContentTypeHeaders HeaderName ctParameters ctSubtypectType ContentTypexhtml-3000.2.1Text.XHtml.InternalsHtml CGIResult CGIOutput CGINothingInput inputValue inputFilenameinputContentType CGIRequestcgiVars cgiInputscgiRequestBodyhRunCGI runCGIEnvFPS decodeInput getCGIVarslogCGI formEncode urlEncode formDecode urlDecode takeInputreplace maybeRead $fShowInput$fShowCGIRequest$fShowCGIResult$fReadCGIResult $fEqCGIResult$fOrdCGIResultMonadCGI cgiAddHeadercgiGetCGITunCGITCGIrunCGITthrowCGIcatchCGItryCGIhandleExceptionCGI$fMonadErrorSomeExceptionCGIT$fMonadTransCGIT$fMonadCGICGIT$fMonadMaskCGIT$fMonadCatchCGIT$fMonadThrowCGIT $fMonadIOCGIT $fMonadCGIT$fApplicativeCGIT $fFunctorCGITCookie cookieName cookieValue cookieExpires cookieDomain cookiePath cookieSecure newCookie findCookie deleteCookie showCookie readCookies $fShowCookie $fReadCookie $fEqCookie $fOrdCookiewrapperpwrapperconnectToCGIScriptLanguageContentEncodingCharset AcceptableAccept negotiaterunCGIoutput 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 lookupOrNilGHC.ListlookupformatResponsedefaultContentTypebodyPartToInput'exceptions-0.8.3-5OTPYzRazb4DJ75sPncYEhControl.Monad.Catch MonadThrowthrowMGHC.BaseNothingghc-prim GHC.TypesTrueshowPair maybeLastgetRequestInputacceptConnectionsaccept'runabortsendBackincludestopQuality starOrEqualToqualitycompareSpecificity hasParameter$fAcceptableLanguage$fHeaderValueLanguage $fOrdLanguage $fEqLanguage$fAcceptableContentEncoding$fHeaderValueContentEncoding$fOrdContentEncoding$fEqContentEncoding$fAcceptableCharset$fHeaderValueCharset $fOrdCharset $fEqCharset$fAcceptableContentType$fHeaderValueAcceptStringbytestring-0.10.8.1Data.ByteString.Lazy.Internal ByteString GHC.Exception Exception errorPage*network-uri-2.6.1.0-6PuDgH21OiwGLI4QZ1g9kt Network.URIURI escapePath errorTextrequestHeaderValue getInput_