{      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  Wraps an /, counting the number of bytes consumed by it. Buffers an iteratee. JOur enumerators produce a lot of little strings; rather than spending all L our time doing kernel context switches for 4-byte write() calls, we buffer % the iteratee to send 8KB at a time. )The IORef returned can be set to True to cancel buffering. We added this N so that transfer-encoding: chunked (which needs its own buffer and therefore  doesn't need its3 output buffered) can switch the outer buffer off. #Creates a buffer to be passed into  . Buffers an iteratee, "unsafely"*. Here we use a fixed binary buffer which  we'Ell re-use, meaning that if you hold on to any of the bytestring data + passed into your iteratee (instead of, let's say, shoving it right out a  socket) it'=ll get changed out from underneath you, breaking referential ! transparency. Use with caution! )The IORef returned can be set to True to cancel buffering. We added this N so that transfer-encoding: chunked (which needs its own buffer and therefore  doesn't need its3 output buffered) can switch the outer buffer off. Buffers an iteratee, "unsafely"*. Here we use a fixed binary buffer which  we'Ell re-use, meaning that if you hold on to any of the bytestring data + passed into your iteratee (instead of, let's say, shoving it right out a  socket) it'=ll get changed out from underneath you, breaking referential ! transparency. Use with caution! )This version accepts a buffer created by . )The IORef returned can be set to True to cancel buffering. We added this N so that transfer-encoding: chunked (which needs its own buffer and therefore  doesn't need its3 output buffered) can switch the outer buffer off.  Enumerates a strict bytestring. Enumerates a lazy bytestring. 4Converts a lazy bytestring to a wrapped bytestring. 4Converts a wrapped bytestring to a lazy bytestring. 6Skip n elements of the stream, if there are that many H This is the Int64 version of the drop function in the iteratee library AReads n elements from a stream and applies the given iteratee to C the stream of the read elements. Reads exactly n elements, and if * the stream is short propagates an error. KReads up to n elements from a stream and applies the given iteratee to the N stream of the read elements. If more than n elements are read, propagates an  error. S     'A case-insensitive newtype wrapper for  \Represents an HTTP response.  !?We will need to inspect the content length no matter what, and  looking up "content-length"' in the headers and parsing the number * out of the text will be too expensive. "#Returns the HTTP status code. $,Returns the HTTP status explanation string. %&output body is sendfile() 'output body is enumerator (@Contains all of the information about an incoming HTTP request. )*>The server name of the request, as it came in from the request's  Host: header. +9Returns the port number the HTTP server is listening on. ,The remote IP address. -The remote TCP port number. .'The local IP address for this request. /9Returns the port number the HTTP server is listening on. 0Returns the HTTP server's idea of its local hostname. 1Returns True if this is an HTTPS session (currently always  False). 234 Returns the Content-Length of the HTTP request body. 5!Returns the HTTP request method. 6-Returns the HTTP version used by the client. 7AReturns a list of the cookies that came in from the HTTP request  headers. 8We'll be doing web components (or "snaplets") for version 0.2. The  " snaplet path"6 refers to the place on the URL where your containing  snaplet is hung. The value of 8 is either "" (at the H top-level context) or is a path beginning with a slash, but not ending  with one. An identity is that:  ) rqURI r == 'S.concat' [ rqSnapletPath r ) , rqContextPath r ( , rqPathInfo r ] /note that until we introduce snaplets in v0.2, 8 will be  "" 9Handlers can ( will be; --ed) be hung on a URI " entry point";  this is called the " context path". If a handler is hung on the  context path "/foo/", and you request "/foo/bar" , the value  of 9 will be "bar". :The " context path" of the request; catenating :, and  9% should get you back to the original ;. The  :& always begins and ends with a slash ("/") 6 character, and represents the path (relative to your  component/*snaplet) you took to get to your handler. ; Returns the URI requested by the client. <'Returns the HTTP query string for this )(. = Returns the @ mapping for this )(. " Parameters" are 1 automatically decoded from the query string and POST body and  entered into this mapping. >?@=A type alias for the HTTP parameters mapping. Each parameter F key maps to a list of ByteString values; if a parameter is specified  multiple times (e.g.: "GET /foo?param=bar1& param=bar2"), looking up  "param" in the mapping will give you ["bar1", "bar2"]. A(A datatype representing an HTTP cookie. BCThe name of the cookie. D The cookie's string value. E The cookie'#s expiration value, if it has one. F The cookie's "domain" value, if it has one. GThe cookie path. HI'Enumerates the HTTP method values (see   5http://tools.ietf.org/html/rfc2068.html#section-5.1.1). JKLMNOPQR6A typeclass for datatypes which contain HTTP headers. SModify the datatype' s headers. T7Retrieve the headers from a datatype that has headers. U7A type alias for a case-insensitive key-value mapping. VW$Adds a header key-value-pair to the R datatype. If a header with N the same name already exists, the new value is appended to the headers list. X"Sets a header key-value-pair in a R datatype. If a header with E the same name already exists, it is overwritten with the new value. Y+Gets all of the values for a given header. ZGets a header value out of a R datatype. If many headers came 9 in with the same name, they will be catenated together. [\]JLooks up the value(s) for the given named parameter. Parameters initially  come from the request'1s query string and any decoded POST body (if the  request's  Content-Type is  application/x-www-form-urlencoded ). Parameter . values can be modified within handlers using rqModifyParams. parameter name to look up  HTTP request ^,Modifies the parameters mapping (which is a Map ByteString ByteString) in  a )( using the given function. _LWrites a key-value pair to the parameters mapping within the given request. parameter name parameter values request ` An empty . a(Sets an HTTP response body to the given V value. new response body  enumerator response to modify b<Sets the HTTP response status. Note: normally you would use  c2 unless you needed a custom response explanation. HTTP response integer code HTTP response explanation Response to be modified cSets the HTTP response code. HTTP response integer code Response to be modified dModifies a response body. e Sets the  Content-Type in the  headers. f Adds an HTTP BA to the  headers.  cookie value response to modify g$A note here: if you want to set the Content-Length for the response, N Snap forces you to do it with this function rather than by setting it in the  headers; the Content-Length! in the headers will be ignored. ?The reason for this is that Snap needs to look up the value of  Content-Length: for each request, and looking the string value up in the G headers and parsing the number out of the text will be too expensive.  If you don'At set a content length in your response, HTTP keep-alive will be  disabled for HTTP/1.0 clients, forcing a Connection: close . For HTTP/1.1 ? clients, Snap will switch to the chunked transfer encoding if  Content-Length is not specified. h Removes any Content-Length set in the . i Converts a  into common log entry format. j Converts a  into an HTTP timestamp. k"Converts an HTTP timestamp into a . lmn#Decodes an URL-escaped string (see   3http://tools.ietf.org/html/rfc2396.html#section-2.4) oURL-escapes a string (see   3http://tools.ietf.org/html/rfc2396.html#section-2.4) pqrst\ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst\VURSTWXYZIQPONMLKJHABCDEFG@>?()*+,-./0123456789:;<=%'&[\ !"#$]^_`abcdefghjiklmnopqrst\ !"#$ !"#$%'&&'()*+,-./0123456789:;<=)*+,-./0123456789:;<=>??@ABCDEFGBCDEFGHIQPONMLKJJKLMNOPQRSTSTUVWXYZ[\]^_`abcdefghijklmnopqrst 0u6This exception is thrown if the handler you supply to  fails. vww is the  that user web handlers run in. w gives you:  , stateful access to fetch or modify an HTTP )( , stateful access to fetch or modify an HTTP   failure /  /  semantics: a w handler can / choose not to handle a given request, using  or its synonym |, 1 and you can try alternative handlers with the  operator:   a :: Snap String  a = pass   b :: Snap String  b = return "foo"   c :: Snap String B c = a <|> b -- try running a, if it fails then try b   convenience functions (, , , ,  ) for writing output to the :  + a :: (forall a . Enumerator a) -> Snap ()  a someEnumerator = do ' writeBS "I'm a strict bytestring" & writeLBS "I'm a lazy bytestring"  addToOutput someEnumerator   early termination: if you call {:   a :: Snap ()  a = do B modifyResponse $ setResponseStatus 500 "Internal Server Error"  writeBS "500 error"  r <- getResponse  finishWith r <then any subsequent processing will be skipped and supplied  value  will be returned from  as-is.   access to the  monad through a  instance:  a :: Snap ()  a = liftIO fireTheMissiles GThe Typeable instance is here so Snap can be dynamically executed with  Hint. x?Sends the request body through an iteratee (data consumer) and  returns the result. y*Returns the request body as a bytestring. zDetaches the request body's V from the )( and B returns it. You would want to use this if you needed to send the D HTTP request body (transformed or otherwise) through to the output ( in O(1) space. (Examples: transcoding, "echo", etc) BNormally Snap is careful to ensure that the request body is fully ? consumed after your web handler runs; this function is marked  "unsafe"1 because it breaks this guarantee and leaves the % responsibility up to you. If you don't fully consume the  V5 you get here, the next HTTP request in the pipeline = (if any) will misparse. Be careful with exception handlers. {Short-circuits a w' monad action early, storing the given   value in its state. |Fails out of a w) monad action. This is used to indicate B that you choose not to handle the given request within the given  handler. }Runs a w! monad action only if the request's HTTP method matches  the given method. ~Runs a w monad action only when the 9 of the request * starts with the given path. For example,   dir "foo" handler  Will fail if 9 is not "/foo" or "/foo/..." , and will  add "foo/" to the handler's local :. path component to match handler to run Runs a w& monad action only for requests where 9 is exactly > equal to the given string. If the path matches, locally sets :  to the old value of 9, sets 9="", and runs the given  handler. path to match against handler to run Runs a w monad action only when 9 is empty. Local Snap version of . Local Snap monad version of .  Grabs the )( object out of the w monad.  Grabs the  object out of the w monad.  Puts a new  object into the w monad.  Puts a new )( object into the w monad.  Modifies the )( object stored in a w monad.  Modifes the  object stored in a w monad. #Performs a redirect by setting the Location header to the given target  URL/'path and the status code to 302 in the  object stored in a  wG monad. Note that the target URL is not validated in any way. Consider  using  'redirect\''8 instead, which allows you to choose the correct status  code. #Performs a redirect by setting the Location header to the given target  URL/Hpath and the status code (should be one of 301, 302, 303 or 307) in the   object stored in a w( monad. Note that the target URL is not  validated in any way. Log an error message in the w monad 1Adds the output from the given enumerator to the   stored in the w monad state. output to add Adds the given strict  to the body of the  stored in  the w monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the ,  the exception won'.t actually be raised within the Snap handler. Adds the given lazy  to the body of the  stored in  the w monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the ,  the exception won'.t actually be raised within the Snap handler. Adds the given strict  to the body of the  stored in the  w monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the ,  the exception won'.t actually be raised within the Snap handler. Adds the given lazy  to the body of the  stored in the  w monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the ,  the exception won'.t actually be raised within the Snap handler. :Sets the output to be the contents of the specified file. Calling 4 will overwrite any output queued to be sent in the  9. If the response body is not modified after the call to  , Snap will use the efficient  sendfile() system call on  platforms that support it. (If the response body is modified (using d), the file will  be read using mmap(). Runs a w action with a locally-modified )( state  object. The )(/ object in the Snap monad state after the call $ to localRequest will be unchanged.  Fetches the )(. from state and hands it to the given action.  Fetches the . from state and hands it to the given action.  Modifies the )( in the state to set the , D field to the value in the X-Forwarded-For header. If the header is ) not present, this action has no effect. CThis action should be used only when working behind a reverse http E proxy that sets the X-Forwarded-For header. This is the only way to @ ensure the value in the X-Forwarded-For header can be trusted. @This is provided as a filter so actions that require the remote E address can get it in a uniform manner. It has specifically limited A functionality to ensure that its transformation can be trusted,  when used correctly.  Modifies the )( in the state to set the , > field to the value from the header specified. If the header 6 specified is not present, this action has no effect. CThis action should be used only when working behind a reverse http E proxy that sets the header being looked at. This is the only way to 0 ensure the value in the header can be trusted. @This is provided as a filter so actions that require the remote E address can get it in a uniform manner. It has specifically limited A functionality to ensure that its transformation can be trusted,  when used correctly. Runs a w monad action in the ' Iteratee IO' monad. See ]8. Looks up a value for the given named parameter in the  )(C. If more than one value was entered for the given parameter name,  ! gloms the values together with:   " "parameter name to look up 0uvwxyz{|}~0uvvwxyz{|}~ EThe internal data type you use to build a routing tree. Matching is done unambiguously.  and   routes can have a fallback route:  For :, the fallback is routed when there is nothing to capture  - For  $, the fallback is routed when we can't find a route in its map 4Fallback routes are stacked: i.e. for a route like:  7 Dir [("foo", Capture "bar" (Action bar) NoRoute)] baz visiting the URI foo/ will result in the bar capture being empty and triggering its fallback. It'*s NoRoute, so we go to the nearest parent 0fallback and try that, which is the baz action.      BA web handler which, given a mapping from URL entry points to web ? handlers, efficiently routes requests to the correct handler. ?The URL entry points are given as relative paths, for example:  ( route [ ("foo/bar/quux", fooBarQuux) ] &If the URI of the incoming request is   /foo/bar/quux or   /foo/bar/quux/...anything... #then the request will be routed to " fooBarQuux", with :  set to "/foo/bar/quux/" and 9 set to  "...anything...". CA path component within an URL entry point beginning with a colon (":")  is treated as a variable capture*; the corresponding path component within * the request URI will be entered into the = parameters mapping with 3 the given name. For instance, if the routes were:  + route [ ("foo/:bar/baz", fooBazHandler) ] Then a request for "/foo/ saskatchewan/baz" would be routed to   fooBazHandler with a mapping for:   "bar" => "saskatchewan" in its parameters table. GLonger paths are matched first, and specific routes are matched before % captures. That is, if given routes:  * [ ("a", h1), ("a/b", h2), ("a/:x", h3) ] a request for "/a/b" will go to h2, "/a/s" for any s will go  to h3, and "/a" will go to h1. The following example matches "/article" to an article index,  "/login" to a login, and "/article/..." to an article renderer. & route [ ("article", renderIndex) ( , ("article/:id", renderArticle) 0 , ("login", method POST doLogin) ] The  function is the same as , except it doesn' t change  the request'9s context path. This is useful if you want to route to a = particular handler but you want that handler to receive the 9 as  it is.                b#$(*+,-.0145679:;<=@ABCDEFGHIJKLMNOPQRSTUVWXZ]^_`abcdefghjknouvwxyz{|}~twuv{|}~xyz(*+,-.0145679:;<=#$URST@IQPONMLKJABCDEFGHWXZ*+,-.0145679:;<=]^_`cb#$efghadVjkon A type alias for MIME type EThe default set of mime type mappings we use when serving files. Its  value:  Map.fromList [ 9 ( ".asc" , "text/plain" ), 9 ( ".asf" , "video/x-ms-asf" ), 9 ( ".asx" , "video/x-ms-asf" ), 9 ( ".avi" , "video/x-msvideo" ), 9 ( ".bz2" , "application/x-bzip" ), 9 ( ".c" , "text/plain" ), 9 ( ".class" , "application/octet-stream" ), 9 ( ".conf" , "text/plain" ), 9 ( ".cpp" , "text/plain" ), 9 ( ".css" , "text/css" ), 9 ( ".cxx" , "text/plain" ), 9 ( ".dtd" , "text/xml" ), 9 ( ".dvi" , "application/x-dvi" ), 9 ( ".gif" , "image/gif" ), 9 ( ".gz" , "application/x-gzip" ), 9 ( ".hs" , "text/plain" ), 9 ( ".htm" , "text/html" ), 9 ( ".html" , "text/html" ), 9 ( ".jar" , "application/x-java-archive" ), 9 ( ".jpeg" , "image/jpeg" ), 9 ( ".jpg" , "image/jpeg" ), 9 ( ".js" , "text/javascript" ), 9 ( ".log" , "text/plain" ), 9 ( ".m3u" , "audio/x-mpegurl" ), 9 ( ".mov" , "video/quicktime" ), 9 ( ".mp3" , "audio/mpeg" ), 9 ( ".mpeg" , "video/mpeg" ), 9 ( ".mpg" , "video/mpeg" ), 9 ( ".ogg" , "application/ogg" ), 9 ( ".pac" , "application/x-ns-proxy-autoconfig" ), 9 ( ".pdf" , "application/pdf" ), 9 ( ".png" , "image/png" ), 9 ( ".ps" , "application/postscript" ), 9 ( ".qt" , "video/quicktime" ), 9 ( ".sig" , "application/pgp-signature" ), 9 ( ".spl" , "application/futuresplash" ), 9 ( ".swf" , "application/x-shockwave-flash" ), 9 ( ".tar" , "application/x-tar" ), 9 ( ".tar.bz2" , "application/x-bzip-compressed-tar" ), 9 ( ".tar.gz" , "application/x-tgz" ), 9 ( ".tbz" , "application/x-bzip-compressed-tar" ), 9 ( ".text" , "text/plain" ), 9 ( ".tgz" , "application/x-tgz" ), 9 ( ".torrent" , "application/x-bittorrent" ), 9 ( ".txt" , "text/plain" ), 9 ( ".wav" , "audio/x-wav" ), 9 ( ".wax" , "audio/x-ms-wax" ), 9 ( ".wma" , "audio/x-ms-wma" ), 9 ( ".wmv" , "video/x-ms-wmv" ), 9 ( ".xbm" , "image/x-xbitmap" ), 9 ( ".xml" , "text/xml" ), 9 ( ".xpm" , "image/x-xpixmap" ), 9 ( ".xwd" , "image/x-xwindowdump" ), : ( ".zip" , "application/zip" ) ] Gets a path from the ( using 9 and makes sure it is I safe to use for opening files. A path is safe if it is a relative path  and has no ..6 elements to escape the intended directory structure. DServes files out of the given directory. The relative path given in  9A is searched for the given file, and the file is served with the : appropriate mime type if it is found. Absolute paths and ".." are prohibited > to prevent files from being served from outside the sandbox. Uses  to determine the  Content-Type based on the file's  extension. root directory Same as +, with control over the MIME mapping used. MIME type mapping root directory @Serves a single file specified by a full or relative path. The # path restrictions on fileServe don't apply to this function since - the path is not being supplied by the user.  path to file Same as +, with control over the MIME mapping used. MIME type mapping  path to file  Runs a w, web handler with compression if available. (If the client has indicated support for gzip or compress in its  Accept-Encoding header, and the  Content-Type in the response is one of  the following types:   application/ x-javascript text/css text/html text/ javascript text/plain text/xml  application/x-font-truetypeThen the given handler'$s output stream will be compressed,  Content-Encoding, will be set in the output headers, and the  Content-Length' will be cleared if it was set. (We can't process the stream 3 in O(1) space if the length is known beforehand.) <The wrapped handler will be run to completion, and then the   that's contained within the w monad state will be passed to  { to prevent further processing. the web handler to run  The same as (, with control over which MIME types to  compress. set of compressible MIME types the web handler to run     !"#$%&'(()*+,-./01223456789:;<=>?@ABCDEFGGHIIJKLMNOPQRSTUVWXYZ[\ ]^_`abcdefghijklmnopqrstuvwxyz { { | } ~        |            ! " # $ % & '()**+,-./01234snap-core-0.2.10Snap.Internal.Debug Snap.IterateeSnap.Internal.Iteratee.DebugData.CIByteStringSnap.Internal.Http.Types Snap.TypesSnap.Util.FileServeSnap.Util.GZipSnap.Internal.TypesSnap.Internal.Routingdebug debugErrno EnumeratorIterateeIterVStream countBytesbufferIterateemkIterateeBufferunsafeBufferIterateeunsafeBufferIterateeWithBufferenumBSenumLBStoWrapfromWrapdrop' takeExactlytakeNoMoreThanenumFile debugIterateeiterateeDebugWrapper CIByteStringunCItoCI ciToLowerc_format_log_timec_format_http_timec_parse_http_time set_c_localeResponse rspHeadersrspHttpVersionrspContentLengthrspBody rspStatusrspStatusReason ResponseBodySendFileEnumRequest rqServerName rqServerPort rqRemoteAddr rqRemotePort rqLocalAddr rqLocalPortrqLocalHostname rqIsSecure rqHeadersrqBodyrqContentLengthrqMethod rqVersion rqCookies rqSnapletPath rqPathInfo rqContextPathrqURI rqQueryStringrqParamsSomeEnumeratorParamsCookie cookieName cookieValue cookieExpires cookieDomain cookiePath HttpVersionMethodCONNECTOPTIONSTRACEDELETEPUTPOSTHEADGET HasHeaders updateHeadersheadersHeaders addHeader setHeader getHeaders getHeader rspBodyMap rspBodyToEnumrqParamrqModifyParams rqSetParam emptyResponsesetResponseBodysetResponseStatussetResponseCodemodifyResponseBodysetContentType addCookiesetContentLengthclearContentLength formatLogTimeformatHttpTime parseHttpTimeparseToCompletion pUrlEscaped urlDecode urlEncodehexdfinishfromStrtoStrstatusReasonMapNoHandlerExceptionSnaprunRequestBodygetRequestBodyunsafeDetachRequestBody finishWithpassmethoddirpathifTop getRequest getResponse putResponse putRequest modifyRequestmodifyResponseredirect redirect'logError addToOutputwriteBSwriteLBS writeText writeLazyTextsendFile localRequest withRequest withResponseipHeaderFilteripHeaderFilter'runSnapgetParamroute routeLocalMimeMapdefaultMimeTypes getSafePath fileServe fileServe'fileServeSinglefileServeSingle'withCompressionwithCompression'bUFSIZ _enumFilemaxMMapFileSizebaseSystem.Posix.Types FileOffsetiteratee-0.3.5Data.Iteratee.IOfileDriverRandom fileDriverData.Iteratee.Binary endianRead4 endianRead3 endianRead2MSBLSBEndianData.Iteratee.BasejoinIMenumPureNChunkenumPure1Chunk>.enumErrenumEofenumPairproductsumfoldl1foldl'foldlfilter convStreamlooseMapStreamrigidMapStream mapStreamtakeRtakelength dropWhiledropseek skipToEofpeekheadsheadidentitybreakcheckErrsetEOFthrowErr stream2stream stream2list liftInnerjoinI checkIfDone isFinishedrunliftIEOFChunkStreamGErrSeekErrMsgDoneContIterGVrunIter IterateeG EnumeratorN EnumeratorGM EnumeratorGMMData.Iteratee.Base.LooseMaplooseMapLooseMapbytestring-0.9.1.7Data.ByteString.Internal ByteString _lowercased lowercaseForeign.C.TypesCTime SnapState _snapRequest _snapResponse _snapLogErrorGHC.BaseMonadControl.Applicative Alternative Control.Monad MonadPlusempty<|>ghc-prim GHC.TypesIOtransformers-0.2.1.0Control.Monad.IO.ClassMonadIOunSnap snapTyConliftIterupdateContextPathpathWithsgetmonads-fd-0.1.0.1Control.Monad.State.ClassgetsmodifymodifyData.ByteString.Lazy.Internal text-0.7.2.1Data.Text.InternalTextData.Text.Lazy.InternalevalSnapData.ByteString intercalateRouteCaptureDirNoRouteAction routeHeightrouteEarliestNCroute' splitPathpRoutefileTypedefaultMimeTypeBadAcceptEncodingExceptioncompressibleMimeTypesgzipCompressioncompressCompression gcompress ccompresscompressEnumerator fullyParse acceptParserparseAcceptEncoding