v      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~            ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u +?Monadic analog to Read that uses ByteString instead of String. ,vFails if the input wasn't parsed completely. +,+,+,, wxyz{needle  needle start needle end (inclusive)  haystack haystack start haystack end (inclusive) |wxy|wyxxy|unknown experimentalbos@serpentine.com}~BThe lower bound on the size of a lookup table. We choose this to , balance table density against performance. Create a set. Check the set for membership. ACheck the set for membership. Only works with 8-bit characters: : characters above code point 255 will give wrong answers. -./0-./0-./0-./0123456789:;< 123456789:;< 123456789:;< 123456789:;<&=>?@&Get the length of a bytestring Stream AEnumerates a Builder. B Enumerates a strict bytestring. CEnumerates a lazy bytestring. DE Wraps an /, counting the number of bytes consumed by it. F#Creates a buffer to be passed into H. GBuffers an iteratee, "unsafely"$. Here we use a fixed binary buffer  which we'@ll re-use, meaning that if you hold on to any of the bytestring 0 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! HBuffers an iteratee, "unsafely"$. Here we use a fixed binary buffer  which we'@ll re-use, meaning that if you hold on to any of the bytestring 0 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 F. I6Skip n elements of the stream, if there are that many J6Skip n elements of the stream, if there are that many KLIReads n bytes from a stream and applies the given iteratee to the stream I of the read elements. Reads exactly n bytes, and if the stream is short  propagates an error. MNOPQRSTUVaction to bump timeout  minimum data rate, in bytes per  second minimum amount of time to let  the iteratee run for iteratee consumer to wrap E  !"#$%&'()*=>?@ABCDEFGHIJKLMNOPQRSTUVEBCANO=UEJFHGKILMDPQRSTV>@?#!"'$%&()*     =>?@ABCDEFGHIJKLMNOPQRSTUVWXYZWXYZXZYWWXYZ^[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. abReturns the HTTP status code. c,Returns the HTTP status explanation string. d3If true, we are transforming the request body with  transformRequestBody ef4output body is sendfile(), optional second argument  is a byte range to send goutput body is a  enumerator h@Contains all of the information about an incoming HTTP request. ij>The server name of the request, as it came in from the request's  Host: header. k9Returns the port number the HTTP server is listening on. lThe remote IP address. mThe remote TCP port number. n'The local IP address for this request. o9Returns the port number the HTTP server is listening on. pReturns the HTTP server's idea of its local hostname. qReturns True if this is an HTTPS session. rst Returns the Content-Length of the HTTP request body. u!Returns the HTTP request method. v-Returns the HTTP version used by the client. wAReturns a list of the cookies that came in from the HTTP request  headers. xWe'll be doing web components (or "snaplets") for version 0.2.  The " snaplet path"+ refers to the place on the URL where your * containing snaplet is hung. The value of x is either  "": (at the 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 / , let q = rqQueryString r & in if S.null q $ then "" 0 else S.append "?" q  ] /note that until we introduce snaplets in v0.2, x will  be "" yHandlers 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 y will be "bar". zThe " context path" of the request; catenating z,  and y% should get you back to the original {  (ignoring query strings). The z always begins and ends  with a slash ("/"/) 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 ih. } Returns the  mapping for this ih. " Parameters" are 1 automatically decoded from the query string and POST body and  entered into this mapping. ~An existential wrapper for the 'Enumerator ByteString IO a' type =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 datatype representing an HTTP cookie. The name of the cookie.  The cookie's string value.  The cookie'#s expiration value, if it has one.  The cookie's "domain" value, if it has one. The cookie path. Tag as secure cookie?  HttpOnly? 'Enumerates the HTTP method values (see   5http://tools.ietf.org/html/rfc2068.html#section-5.1.1). 6A typeclass for datatypes which contain HTTP headers. Modify the datatype' s headers. 7Retrieve the headers from a datatype that has headers. $Adds a header key-value-pair to the  datatype. If a header M with the same name already exists, the new value is appended to the headers  list. "Sets a header key-value-pair in a  datatype. If a header with E the same name already exists, it is overwritten with the new value. +Gets all of the values for a given header. Gets a header value out of a  datatype. If many headers came 9 in with the same name, they will be catenated together. Lists all the headers out of a  datatype. If many F headers came in with the same name, they will be catenated together. Clears a header value from a  datatype. 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). 8 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 ih using the given function. CWrites a key-value pair to the parameters mapping within the given  request. parameter name parameter values request  An empty \[. (Sets an HTTP response body to the given ) value. new response body enumerator response to modify <Sets the HTTP response status. Note: normally you would use  2 unless you needed a custom response explanation. HTTP response integer code HTTP response explanation Response to be modified Sets the HTTP response code. HTTP response integer code Response to be modified Modifies a response body.  Sets the  Content-Type in the \[ headers.  Adds an HTTP  to \[ headers.  cookie value response to modify  Gets an HTTP  with the given name from \[ headers.  cookie name response to query Returns a list of  s present in \[ response to query Deletes an HTTP  from the \[ headers. Please note E this does not necessarily erase the cookie from the client browser.  cookie name response to modify Modifies an HTTP  with given name in \[ headers. # Nothing will happen if a matching  can not be found in \[.  cookie name modifier function response to modify $A note here: if you want to set the Content-Length for the response, J 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/B1.1 clients, Snap will switch to the chunked transfer encoding if  Content-Length is not specified.  Removes any Content-Length set in the \[.  Converts a  into common log entry format.  Converts a  into an HTTP timestamp. "Converts an HTTP timestamp into a . ^[\]^_`abcdefghijklmnopqrstuvwxyz{|}~^~hijklmnopqrstuvwxyz{|}egf[\]^_`abcd^[ \]^_`abcd\]^_`abcdegffghijklmnopqrstuvwxyz{|}ijklmnopqrstuvwxyz{|}~(1Parsers for different tokens in an HTTP request. 1Parsers for different tokens in an HTTP request. 1Parsers for different tokens in an HTTP request.  Parser for zero or more spaces. Parser for request headers. #Decodes an URL-escaped string (see   3http://tools.ietf.org/html/rfc2396.html#section-2.4) URL-escapes a string (see   3http://tools.ietf.org/html/rfc2396.html#section-2.4) URL-escapes a string (see   3http://tools.ietf.org/html/rfc2396.html#section-2.4 ) into a . Parses a string encoded in  application/x-www-form-urlencoded format. (((TJThis is exception is thrown if the handler chooses to escape regular HTTP  traffic. ?An exception hierarchy for exceptions that cannot be caught by  user-defined error handlers 6This exception is thrown if the handler you supply to  fails.  is the  that user web handlers run in.  gives you:  , stateful access to fetch or modify an HTTP ih , stateful access to fetch or modify an HTTP \[  failure /  /  semantics: a  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 queueing output to be written to the \[:  + a :: (forall a . Enumerator a) -> Snap ()  a someEnumerator = do ' writeBS "I'm a strict bytestring" & writeLBS "I'm a lazy bytestring" ! writeText "I'm strict text"  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  G the ability to set a timeout which will kill the handler thread after N 6 seconds of inactivity (the default is 20 seconds):   a :: Snap ()  a = setTimeout 30  $ throw and catch exceptions using a  instance:   foo :: Snap () . foo = bar `catch` \(e::SomeException) -> baz  where  bar = throw FooException  ! log a message to the error log:   foo :: Snap ()  foo = logError "grumble." IYou may notice that most of the type signatures in this module contain a (MonadSnap m) => ... typeclass constraint.  is a typeclass which, in essence, says "you can get back to the  monad from here". Using  you can extend the ) monad with additional functionality and !still have access to most of the  functions without writing  Heverywhere. Instances are already provided for most of the common monad transformers (ReaderT, WriterT,  , etc.).  is a type class, analogous to  for  , that makes  it easy to wrap  inside monad transformers. GThe Typeable instance is here so Snap can be dynamically executed with  Hint. ?Sends the request body through an iteratee (data consumer) and  returns the result. KIf the iteratee you pass in here throws an exception, Snap will attempt to L clear the rest of the unread request body before rethrowing the exception.  If your iteratee used !, however, Snap will give up and  immediately close the socket. /Returns the request body as a lazy bytestring. JThis function is deprecated as of 0.6; it places no limits on the size of ? the request being read, and as such, if used, can result in a 5 denial-of-service attack on your server. Please use   instead. /Returns the request body as a lazy bytestring.  New in 0.6. #size of the largest request body we' re willing 2 to accept. If a request body longer than this is  received, a > is  thrown. See M. BNormally Snap is careful to ensure that the request body is fully 6 consumed after your web handler runs, but before the \[ enumerator L is streamed out the socket. If you want to transform the request body into : some output in O(1) space, you should use this function. LNote that upon calling this function, response processing finishes early as  if you called 0. Make sure you set any content types, headers, . cookies, etc. before you call this function.  the output  is passed to this  ), and then the resulting  is # fed the request body stream. Your ) is ) responsible for transforming the input. Short-circuits a ' monad action early, storing the given  \[ value in its state. 4Capture the flow of control in case a handler calls . WARNING: in the event of a call to  it is possible G to violate HTTP protocol safety when using this function. If you call  8 it is suggested that you do not modify the body of the  \[ which was passed to the  call. Fails out of a ) monad action. This is used to indicate B that you choose not to handle the given request within the given  handler. Runs a ! monad action only if the request's HTTP method matches  the given method. Runs a ! monad action only if the request's HTTP method matches  one of the given methods. Runs a  monad action only when the y of the request * starts with the given path. For example,   dir "foo" handler  Will fail if y is not "/foo" or "/foo/..." , and will  add "foo/" to the handler's local z. path component to match handler to run Runs a & monad action only for requests where y is F exactly equal to the given string. If the path matches, locally sets  z to the old value of y, sets y="",  and runs the given handler. path to match against handler to run Runs a 4 monad action only when the first path component is G successfully parsed as the argument to the supplied handler function. Runs a  monad action only when y is empty. Local Snap version of . Local Snap monad version of .  Grabs the ih object out of the  monad. Grabs something out of the ih$ object, using the given projection  function. See .  Grabs the \[ object out of the  monad. Grabs something out of the \[$ object, using the given projection  function. See .  Puts a new \[ object into the  monad.  Puts a new ih object into the  monad.  Modifies the ih object stored in a  monad.  Modifes the \[ object stored in a  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  > monad. Note that the target URL is not validated in any way.  Consider using  'redirect\''1 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 ( monad. Note that the target URL is not  validated in any way. Log an error message in the  monad 1Adds the output from the given enumerator to the \[  stored in the  monad state. output to add Adds the given  to the body of the \[ stored in the  |  monad state. Adds the given strict  to the body of the \[ stored  in the  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  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  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   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  ), the file  will be read using mmap(). ESets the output to be the contents of the specified file, within the  given (start,end) range. Calling 0 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  ), the file  will be read using mmap(). Runs a  action with a locally-modified ih state  object. The ih/ object in the Snap monad state after the call $ to localRequest will be unchanged.   Fetches the ih. from state and hands it to the given action.   Fetches the \[. from state and hands it to the given action.   Modifies the ih in the state to set the l 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 ih in the state to set the l > 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.  AThis function brackets a Snap action in resource acquisition and / release. This is provided because MonadCatchIO's  function  doesn';t work properly in the case of a short-circuit return from  the action being bracketed. ;In order to prevent confusion regarding the effects of the A aquisition and release actions on the Snap state, this function  doesn':t accept Snap actions for the acquire or release actions. AThis function will run the release action in all cases where the B acquire action succeeded. This includes the following behaviors ! from the bracketed Snap action.  Normal completion / Short-circuit completion, either from calling  or   An exception being thrown. 5Terminate the HTTP session with the given exception. FTerminate the HTTP session and hand control to some external handler, $ escaping all further HTTP traffic. KThe external handler takes two arguments: a function to tickle the timeout ) manager, and a write end to the socket. Runs a  monad action in the ' Iteratee IO' monad. See 8. Looks up a value for the given named parameter in the  ihC. If more than one value was entered for the given parameter name,  ! gloms the values together with:   " "parameter name to look up See }!. Convenience function to return  from the  ih inside of a  instance. Gets the HTTP  with the specified name. Gets the HTTP 1 with the specified name and decodes it. If the ) decoding fails, the handler calls pass. Expire the given  in client' s browser.  Cookie name Cookie domain 'Causes the handler thread to be killed n seconds from now.  Returns an 6 action which you can use to reset the handling thread's  timeout value. T     T      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 z  set to "/foo/bar/quux/" and y 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) ]  URL decoding MA short note about URL decoding: path matching and variable capture are done  on decoded URLs, but the contents of z and y will L contain the original encoded URL, i.e. what the user entered. For example,  in the following scenario:   route [ ("a b c d/", foo ) ] A request for "/a+b+c+d" will be sent to foo with z set  to "a+b+c+d". KThis behaviour changed as of Snap 0.6.1; previous versions had unspecified  (and buggy!) semantics here. 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 y as  it is. .action to run before we call the user handler the "context"; the list of path segments we've 0 already successfully matched, in reverse order "the list of path segments we haven't yet matched  FGiven a Response, asserts that its HTTP status code is 200 (success). HGiven a Response, asserts that its HTTP status code is 404 (Not Found). GGiven a Response, asserts that its HTTP status code is between 300 and J 399 (a redirect), and that the Location header of the Response points to  the specified URI. %The Response should redirect to this  URI GGiven a Response, asserts that its HTTP status code is between 300 and  399 (a redirect). BGiven a Response, asserts that its body matches the given regular  expression. (Regexp that will match the body content )1[bchjklmnpqtuvwyz{|}~        hjklmnpqtuvwyz{|}[bc1  jklmnpqtuvwyz{|}bc)~)1[bchjklmnpqtuvwyz{|}~     0 The  1 datatype enumerates the different kinds of HTTP H requests you can generate using the testing interface. Most users will  prefer to use the :, <, =, >, and  ; convenience functions. !"#$%&'(the file's name )the file's content-type *the file contents +,&a file upload consisting of the given '& values. -(a form variable consisting of the given  values. .A request body of type " multipart/ form-data" consists of a set of K named form parameters, each of which can by either a list of regular form " values or a set of file uploads. /FRequestBuilder is a monad transformer that allows you to conveniently  build a snap ih for testing. 0Runs a /, producing the desired ih. 1Sets the type of the ih being built. 2Sets the request'2s query string to be the raw bytestring provided, I without any escaping or other interpretation. Most users should instead  choose the 3, function, which takes a parameter mapping. 3>Escapes the given parameter mapping and sets it as the request's query  string. 4ISets the given header in the request being built, overwriting any header % with the same name already present. 52Adds the given header to the request being built. 6Sets the request's  content-type to the given MIME type. 7IControls whether the test request being generated appears to be an https  request or not. 8Sets the test request's http version 9Sets the request',s path. The path provided must begin with a "/" and  must not? contain a query string; if you want to provide a query string $ in your test request, you must use 3 or 2.  Note that z is never set by any / function. :Builds an HTTP "GET"* request with the given query parameters.  request path request's form parameters ;Builds an HTTP "DELETE"* request with the given query parameters.  request path request's form parameters <Builds an HTTP "POST"3 request with the given form parameters, using the  " application/x-www-form-urlencoded" MIME type.  request path request's form parameters =Builds an HTTP "POST"3 request with the given form parameters, using the  " form-data/ multipart" MIME type.  request path multipart form parameters >Builds an HTTP "PUT" request.  request path request body MIME content-type request body contents ? Builds a "raw" HTTP "POST", request, with the given MIME type and body  contents.  request path request body MIME content-type request body contents Given a web handler in some  monad, and a / > defining a test request, runs the handler, producing an HTTP \[. a function defining how the  monad should be run a request builder a web handler @Given a web handler in the  monad, and a / defining 5 a test request, runs the handler, producing an HTTP \[. a request builder a web handler A$Dumps the given response to stdout. B-Converts the given response to a bytestring. $ !"#$%&'()*+,-./0123456789:;<=>?@AB$ %$#"!!"#$%&'()*'()*+-,,-./0123456789:;<=>?@AB ) !"#$%&'()*+,-./0123456789:;<=>?@AB)/.+-,&'()* %$#"!0@:<=>?;564832917AB "CEA collection of options for serving static files out of a directory. DECFiles to look for when a directory is requested (e.g., index.html) F>Handler to generate a directory listing if there is no index. GCMap of extensions to pass to dynamic file handlers. This could be I used, for example, to implement CGI dispatch, pretty printing of source  code, etc. H(MIME type map to look up content types. IAHandler that is called before a file is served. It will only be F called when a file is actually found, not for generated index pages. JA type alias for MIME type K"A type alias for dynamic handlers LGets a path from the h using y 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. METhe 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 ( ".json" , "application/json" ), 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 ( ".svg" , "image/svg+xml" ), 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" ) ] =Style information for the default directory index generator. NIAn automatic index generator, which is fairly small and does not rely on J any external files (which may not be there depending on external request  routing). A J= is passed in to display the types of files in the directory L listing based on their extension. Preferably, this is the same as the map  in the DC JThe styles parameter allows you to apply styles to the directory listing. G The listing itself consists of a table, containing a header row using J th elements, and one row per file using td elements, so styles for those 1 pieces may be attached to the appropriate tags. &MIME type mapping for reporting types Style info to insert in header  Directory to generate index for OGA very simple configuration for directory serving. This configuration  uses built-in MIME types from M, and has no index files, , index generator, dynamic file handlers, or I. P@A reasonable default configuration for directory serving. This - configuration uses built-in MIME types from M , serves  common index files  index.html and  index.htm, but does not autogenerate < directory indexes, nor have any dynamic file handlers. The I  will not do anything. QEA more elaborate configuration for file serving. This configuration  uses built-in MIME types from M, serves common index files   index.html and  index.htm-, and autogenerates directory indexes with a = Snap-like feel. It still has no dynamic file handlers, nor I, " which should be added as needed. $Files recognized as indexes include  index.html,  index.htm,   default.html,  default.htm,  home.html REServes static files from a directory using the default configuration  as given in P. Directory to serve from SAServes static files from a directory. Configuration options are  passed in a DC- that captures various choices about desired ' behavior. The relative path given in y is searched for a M requested 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. Configuration options Directory to serve from THServes a single file specified by a full or relative path. If the file 7 does not exist, throws an exception (not that it does not pass to the + next handler). The path restrictions on R don' t apply to A this function since the path is not being supplied by the user.  path to file USame as T+, with control over the MIME mapping used.  MIME type  path to file VCDEFGHIJKLMNOPQRSTUVLJKCDEFGHIOPQNMVRSTUCDEFGHIDEFGHIJKLMNOPQRSTUV J=This is the file which is currently being written to. If the @ calling function gets an exception here, it is responsible for ! closing and deleting this file. C.. and these files have already been successfully read and closed. WUpload policy can be set on an "general" basis (using X), B but handlers can also make policy decisions on individual files/parts : uploaded. For each part uploaded, handlers can decide: ) whether to allow the file upload at all 0 the maximum size of uploaded files, if allowed XX/ controls overall policy decisions relating to   multipart/ form-data uploads, specifically: K whether to treat parts without filenames as form input (reading them into  the } map) J because form input is read into memory, the maximum size of a form input > read in this manner, and the maximum number of form inputs C the minimum upload rate a client must maintain before we kill the K connection; if very low-bitrate uploads were allowed then a Snap server > would be vulnerable to a trivial denial-of-service using a  " slowloris" -type attack I the minimum number of seconds which must elapse before we start killing . uploads for having too low an upload rate. D the amount of time we should wait before timing out the connection . whenever we receive input from the client. YZ[\];All of the exceptions defined in this package inherit from  ], so if you write  0 foo `catch` \(e :: FileUploadException) -> ... you can catch a [, a Y, etc.     ^_^ contains information about a "part" in a request uploaded  with Content-type: multipart/ form-data. _`abcIReads uploaded files into a temporary directory and calls a user handler  to process them. KGiven a temporary directory, global and file-specific upload policies, and E a user handler, this function consumes a request body uploaded with  Content-type: multipart/ form-data'. Each file is read into the temporary H directory, and then a list of the uploaded files is passed to the user 6 handler. After the user handler runs (but before the [ body  )> is streamed to the client), the files are deleted from disk; E so if you want to retain or use the uploaded files in the generated = response, you would need to move or otherwise process them. 6The argument passed to the user handler is a list of:  6 (PartInfo, Either PolicyViolationException FilePath) "The first half of this tuple is a _^, which contains the G information the client browser sent about the given upload part (like C filename, content-type, etc). The second half of this tuple is an    stipulating that either:  A the file was rejected on a policy basis because of the provided  W handler 5 the file was accepted and exists at the given path. If the request's  Content-type was not " multipart/formdata", this ! function skips processing using .  If the client'7s upload rate passes below the configured minimum (see  l and n), this function H terminates the connection. This setting is there to protect the server 4 against slowloris-style denial of service attacks.  If the given X, stipulates that you wish form inputs to be  placed in the } parameter map (using h), and M a form input exceeds the maximum allowable size, this function will throw a  Y. GIf an uploaded part contains MIME headers longer than a fixed internal 8 threshold (currently 32KB), this function will throw a [. temporary directory general upload policy per-part upload policy user handler (see function  description) d:Given an upload policy and a function to consume uploaded "parts", & consume a request body uploaded with Content-type: multipart/ form-data. & Normally most users will want to use c (which writes K uploaded files to a temporary directory and passes their names to a given 5 handler) rather than this function; the lower-level d J function should be used if you want to stream uploaded files to your own  iteratee function. If the request's  Content-type was not " multipart/formdata", this ! function skips processing using .  If the client'7s upload rate passes below the configured minimum (see  l and n), this function H terminates the connection. This setting is there to protect the server 4 against slowloris-style denial of service attacks.  If the given X, stipulates that you wish form inputs to be  placed in the } parameter map (using h), and M a form input exceeds the maximum allowable size, this function will throw a  Y. GIf an uploaded part contains MIME headers longer than a fixed internal 8 threshold (currently 32KB), this function will throw a [. global upload policy part processor efGA reasonable set of defaults for upload policy. The default policy is: maximum form input size 128kB maximum number of form inputs 10 minimum upload rate 1kB/s %seconds before rate limiting kicks in 10 inactivity timeout 20 seconds gFDoes this upload policy stipulate that we want to treat parts without  filenames as form input? hJSet the upload policy for treating parts without filenames as form input. iAGet the maximum size of a form input which will be read into our  } map. jASet the maximum size of a form input which will be read into our  } map. kGet the minimum rate (in bytes\second/ ) a client must maintain before  we kill the connection. lSet the minimum rate (in bytes\second/ ) a client must maintain before  we kill the connection. mGGet the amount of time which must elapse before we begin enforcing the  upload rate minimum nGSet the amount of time which must elapse before we begin enforcing the  upload rate minimum oGet the "upload timeout".. Whenever input is received from the client, B the connection timeout is set this many seconds in the future. pSet the upload timeout. q#Disallows the file to be uploaded. r2Allows the file to be uploaded, with maximum size n. maximum size of form input file reading code boundary value part processor Given a w6 stream which is partitioned by boundary values, read H up until the next boundary and send all of the chunks into the wrapped  iteratee  Assuming we'1ve already identified the boundary value and run  |8 to split the input up into parts which match and parts  which don't, run the given $ iteratee over each part and grab a  list of the resulting values.  !"WXYZ[\]^_`abcdefghijklmnopqrcd^_`abXfghijklmnopWqr]e[\\YZZWXYZZ[\\]^_`ab_`abcdefghijklmnopqr #$sRuns a , 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 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  monad state will be passed to   to prevent further processing. the web handler to run t The same as s(, with control over which MIME types to  compress. set of compressible MIME types the web handler to run u Turn off compression by setting "Content-Encoding: identity" in the  response headers. %&'()*+stustustu, !"#$%&'(')'*'+,-,.,/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsttuvwxyz{|}~      !"#$%&'()*+,-./01234567899:;<=>?@ABCDEFGHIRJKLMNOP Q Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k k l m n o p q r s t u v w x y z { | } ~         QUVWXYKIA                        d  e       f h              ! " # $ % & ' ( ) * + , - . . / 0 1 2 3 4 56 snap-core-0.7 Snap.IterateeSnap.Util.ReadableSnap.Internal.DebugSnap.Types.HeadersSnap.Internal.Iteratee.DebugSnap.Internal.Http.TypesSnap.Internal.Parsing Snap.Core Snap.TestSnap.Util.FileServeSnap.Util.FileUploadsSnap.Util.GZip)Snap.Internal.Iteratee.BoyerMooreHorspoolSnap.Internal.Parsing.FastSetSnap.Internal.TypesSnap.Internal.InstancesSnap.Internal.RoutingSnap.Internal.Test.Assertions Snap.Types!Snap.Internal.Test.RequestBuilderenumerator-0.4.16Data.Enumerator catchError throwErrorData.Enumerator.InternalIterateepeek liftTransisEOFsequence$==$joinI concatEnumsenumList printChunksrun_runData.Enumerator.Compatibility liftFoldM liftFoldL' liftFoldLliftIData.Enumerator.Listheadconsumemap checkDoneenumEOF<==<>==>$$==<<>>==continueyieldreturnIChunksEOFStreamContinueYieldErrorStep runIteratee Enumerator EnumerateeReadablefromBSdebug debugErrno debugIgnoredebugErrnoIgnoreHeadersemptynullmemberlookuplookupWithDefaultinsertsetdeletefoldtoListfromListInvalidRangeExceptionTooManyBytesReadExceptionRateTooSlowExceptionShortWriteException enumBuilderenumBSenumLBS skipToEof countBytesmkIterateeBufferunsafeBufferIterateeunsafeBufferIterateeWithBufferdropdrop'take takeExactlytakeNoMoreThanenumFileenumFilePartialmapEnummapIterenumBuilderToByteStringunsafeEnumBuilderToByteStringenumByteStringToBuilderjoinI' killIfTooSlow showBuilder debugIterateeiterateeDebugWrapperWithiterateeDebugWrapperResponse rspHeaders rspCookiesrspHttpVersionrspContentLengthrspBody rspStatusrspStatusReasonrspTransformingRqBody ResponseBodySendFileEnumRequest rqServerName rqServerPort rqRemoteAddr rqRemotePort rqLocalAddr rqLocalPortrqLocalHostname rqIsSecure rqHeadersrqBodyrqContentLengthrqMethod rqVersion rqCookies rqSnapletPath rqPathInfo rqContextPathrqURI rqQueryStringrqParamsSomeEnumeratorParamsCookie cookieName cookieValue cookieExpires cookieDomain cookiePath cookieSecurecookieHttpOnly HttpVersionMethodCONNECTOPTIONSTRACEDELETEPUTPOSTHEADGET HasHeaders updateHeadersheadersc_format_log_timec_format_http_timec_parse_http_time set_c_locale addHeader setHeader getHeaders getHeader listHeaders deleteHeader rspBodyMap rspBodyToEnumrqParamrqModifyParams rqSetParam emptyResponsesetResponseBodysetResponseStatussetResponseCodemodifyResponseBodysetContentTypeaddResponseCookiegetResponseCookiegetResponseCookiesdeleteResponseCookiemodifyResponseCookiesetContentLengthclearContentLength formatLogTimeformatHttpTime parseHttpTimefromStrtoStrstatusReasonMap fullyParseparseNumspdigitletteruntilEOLcrlf generateFSspacespSpaces fieldChars fieldCharSetpHeaderspWord pQuotedString isRFCTextmatchAllpAvPairspAvPair pParametertrimpValueWithParameterspContentTypeWithParameterspTokenisToken tokenTableparseToCompletion pUrlEscaped urlDecode urlEncodeurlEncodeBuilderurlEncodeTablehexdfinishparseUrlEncodedbuildUrlEncodedprintUrlEncodedpCookies parseCookie strictizeEscapeHttpExceptionNoHandlerExceptionSnap MonadSnapliftSnaprunRequestBodygetRequestBodyreadRequestBodytransformRequestBody finishWithcatchFinishWithpassmethodmethodsdirpathpathArgifTop getRequest getsRequest getResponse getsResponse putResponse putRequest modifyRequestmodifyResponseredirect redirect'logError addToOutput writeBuilderwriteBSwriteLBS writeText writeLazyTextsendFilesendFilePartial localRequest withRequest withResponseipHeaderFilteripHeaderFilter' bracketSnapterminateConnection escapeHttprunSnapgetParam getParams getCookie readCookie expireCookie setTimeoutgetTimeoutActionroute routeLocalgetResponseBody assertSuccess assert404assertRedirectToassertRedirectassertBodyContains RequestType DeleteRequestUrlEncodedPostRequestMultipartPostRequestRequestWithRawBody GetRequestFileData fdFileName fdContentType fdContentsMultipartParamFilesFormDataMultipartParamsRequestBuilder buildRequestsetRequestTypesetQueryStringRawsetQueryString setSecuresetHttpVersionsetRequestPathgetpostUrlEncoded postMultipartputpostRaw runHandler dumpResponseresponseToStringDirectoryConfig indexFilesindexGeneratordynamicHandlers mimeTypes preServeHookMimeMap HandlerMap getSafePathdefaultMimeTypesdefaultIndexGeneratorsimpleDirectoryConfigdefaultDirectoryConfigfancyDirectoryConfigserveDirectoryserveDirectoryWith serveFile serveFileAsfileTypePartUploadPolicy UploadPolicyPolicyViolationExceptionpolicyViolationExceptionReasonBadPartExceptionbadPartExceptionReasonFileUploadExceptionPartInfo partFieldName partFileNamepartContentTypehandleFileUploadshandleMultipartfileUploadExceptionReasondefaultUploadPolicydoProcessFormInputssetProcessFormInputsgetMaximumFormInputSizesetMaximumFormInputSizegetMinimumUploadRatesetMinimumUploadRategetMinimumUploadSecondssetMinimumUploadSecondsgetUploadTimeoutsetUploadTimeoutdisallowallowWithMaximumSizewithCompressionwithCompression' noCompression checkComplete MatchInfoNoMatchMatch lookaheadmatches bmhEnumerateeIFastSetTableSortedfromSet tableCutoffshiftRshiftLindex memberWord8 memberCharmkTable charClassHunH streamLengthbUFSIZtake' _enumFile_enumFilePartialmaxMMapFileSize tooBigForMMapgetTimeblaze-builder-0.3.0.2'Blaze.ByteString.Builder.Internal.TypesBuilderbaseForeign.C.TypesCTimeConnectionTerminatedExceptionUncatchableException SnapState _snapRequest _snapResponse _snapLogError_snapSetTimeoutunSnap SnapResultEarlyTerminationPassOnProcessing SnapValueGHC.BaseMonadControl.Applicative Alternative Control.Monad MonadPlus<|>ghc-prim GHC.TypesIOtransformers-0.2.2.0Control.Monad.IO.ClassMonadIO!MonadCatchIO-transformers-0.2.2.3Control.Monad.CatchIO MonadCatchIOControl.Monad.Trans.ClassliftControl.Monad.Trans.State.LazyStateTsnapBind snapReturnsnapFailrethrowIfUncatchable snapTyConliftIterupdateContextPathpathWithsget mtl-2.0.1.0Control.Monad.State.Classsmodifymodifygetsbytestring-0.9.2.0Data.ByteString.Internal ByteStringData.ByteString.Lazy.Internaltext-0.11.1.10Data.Text.InternalTextData.Text.Lazy.InternalbracketfailuncatchableExceptionToException!uncatchableExceptionFromExceptionevalSnapData.ByteString intercalateRouteCaptureDirNoRouteAction routeHeightrouteEarliestNCroute' splitPathpRoutemkDefaultRequest makeBoundarymultipartHeaderencodeFormDatamultipartMixed encodeFilesencodeMultipartfixupURI runHandler'rGetrPutrModifyRangeReqSuffixRangeReq _suffixLength _rangeFirst _rangeLastsnapIndexStyles lookupExtdefaultMimeType rangeParser checkRangeReqdbguriWithoutQueryStringqueryStringSuffix UploadedFilesUploadedFilesState _currentFile_alreadyReadFilesFile_maximumFileSizeprocessFormInputsmaximumFormInputSizemaximumNumberOfFormInputsminimumUploadRateminimumUploadSeconds uploadTimeoutWrappedFileUploadException_wrappedFileUploadException!_wrappedFileUploadExceptionReasonGenericFileUploadException!_genericFileUploadExceptionReason Data.EitherEitheruploadExceptionToExceptionuploadExceptionFromExceptioncaptureVariableOrReadFile fileReaderinternalHandleMultipartgetContentType getFieldName findParam processPart processPartseolpHeadersWithSeparator toHeaders mAX_HDRS_SIZEemptyUploadedFilesStatenewUploadedFilescleanupUploadedFilesopenFileForUploadcloseActiveFile eatException makeTempFileBadAcceptEncodingExceptioncompressibleMimeTypesgzipCompressioncompressCompression gcompress ccompress acceptParserparseAcceptEncoding