s\-      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                       ! " # $ % & ' ( ) * + , )Runs a Snap monad action only when  rqPathInfo is empty. *-Fails if the input wasn't parsed completely. )*)*)** ./012needle  needle start needle end (inclusive)  haystack haystack start haystack end (inclusive) 3./03.0//03+,-1Parsers for different tokens in an HTTP request. .1Parsers for different tokens in an HTTP request. /1Parsers for different tokens in an HTTP request. 012 Parser for zero or more spaces. 3456Parser for request headers. 789:;<=>?@ABC+,-./0123456789:;<=>?@ABC+,-/.0123456789:;<=>?@ABC+,-./0123456789:;<=>?@ABCDEFGDEFGDEFGDEFG#H4I5J6K78&Get the length of a bytestring Stream LEnumerates a Builder. M Enumerates a strict bytestring. NEnumerates a lazy bytestring. OP Wraps an /, counting the number of bytes consumed by it. 9Q#Creates a buffer to be passed into S. RBuffers 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! SBuffers 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 Q. T6Skip n elements of the stream, if there are that many U6Skip n elements of the stream, if there are that many V:WIReads 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. X;<=>YZ[\]^action to bump timeout  minimum data rate, in bytes per  second minimum amount of time to let  the iteratee run for iteratee consumer to wrap ?@  !"#$%&'(HIJKLMNOPQRSTUVWXYZ[\]^@MNLYZH]PUQSRVTWXO[\^IKJ!%"#$&'(  HIJKLMNOPQRSTUVWXYZ[\]^_`ab_`ab`ba__`abccRepresents an HTTP response. defgh?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. ijReturns the HTTP status code. k,Returns the HTTP status explanation string. l3If true, we are transforming the request body with  transformRequestBody mn4output body is sendfile(), optional second argument  is a byte range to send ooutput body is a @ enumerator p@Contains all of the information about an incoming HTTP request. qr>The server name of the request, as it came in from the request's  Host: header. s9Returns the port number the HTTP server is listening on. tThe remote IP address. uThe remote TCP port number. v'The local IP address for this request. w9Returns the port number the HTTP server is listening on. xReturns the HTTP server's idea of its local hostname. yReturns True if this is an HTTPS session. z{| Returns the Content-Length of the HTTP request body. }!Returns the HTTP request method. ~-Returns the HTTP version used by the client. AReturns a list of the cookies that came in from the HTTP request  headers. We'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  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,  will  be "" Handlers 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  will be "bar". The " context path" of the request; catenating , and  % should get you back to the original  (ignoring  query strings). The  always begins and ends with a  slash ("/"7) 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 qp.  Returns the  mapping for this qp. " 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. '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. 7A type alias for a case-insensitive key-value mapping. $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. 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 qp using the given function. CWrites a key-value pair to the parameters mapping within the given  request. parameter name parameter values request  An empty dc. (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 dc headers. EaddCookie has been deprecated and will be removed in 0.5. Please use   instead.  cookie value response to modify  Adds an HTTP  to dc headers.  cookie value response to modify  Gets an HTTP  with the given name from dc headers.  cookie name response to query Returns a list of  s present in dc response to query Deletes an HTTP  from the dc headers.  cookie name response to modify Modifies an HTTP  with given name in dc headers. # Nothing will happen if a matching  can not be found in dc.  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 dc.  Converts a A into common log entry format.  Converts a A into an HTTP timestamp. "Converts an HTTP timestamp into a A. #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) ccdefghijklmnopqrstuvwxyz{|}~cpqrstuvwxyz{|}~moncdefghijklcc defghijkldefghijklmonnopqrstuvwxyz{|}~qrstuvwxyz{|}~ IBC6This exception is thrown if the handler you supply to  fails. DEFGHIJKLMNO is the P that user web handlers run in.  gives you:  , stateful access to fetch or modify an HTTP qp , stateful access to fetch or modify an HTTP dc  failure / Q / R semantics: a  handler can / choose not to handle a given request, using S or its synonym , 1 and you can try alternative handlers with the T 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 dc:  + 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 dc  value will be returned from  as-is.   access to the U monad through a V instance:   a :: Snap ()  a = liftIO fireTheMissiles  G the ability to set a timeout which will kill the handler thread after N  seconds of inactivity:   a :: Snap ()  a = setTimeout 30 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 W Heverywhere. Instances are already provided for most of the common monad transformers (ReaderT, WriterT, XY , etc.).  is a type class, analogous to V for U , that makes  it easy to wrap  inside monad transformers. Z[\]^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 bytestring. BNormally Snap is careful to ensure that the request body is fully 6 consumed after your web handler runs, but before the dc 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  dc 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  dc 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. `aRuns a  monad action only when the  of the request * starts with the given path. For example,   dir "foo" handler  Will fail if  is not "/foo" or "/foo/..." , and will  add "foo/" to the handler's local . path component to match handler to run Runs a & monad action only for requests where  is F exactly equal to the given string. If the path matches, locally sets   to the old value of , sets ="",  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  is empty. bLocal Snap version of c. dLocal Snap monad version of e.  Grabs the qp object out of the  monad.  Grabs the dc object out of the  monad.  Puts a new dc object into the  monad.  Puts a new qp object into the  monad.  Modifies the qp object stored in a  monad.  Modifes the dc 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 dc 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  dc 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 dc  stored in the  monad state. output to add Adds the given @ to the body of the dc stored in the  |  monad state. Adds the given strict f to the body of the dc stored  in the  monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the f,  the exception won'.t actually be raised within the Snap handler. Adds the given lazy g to the body of the dc stored  in the  monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the f,  the exception won'.t actually be raised within the Snap handler. Adds the given strict h to the body of the dc stored in  the  monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the f,  the exception won'.t actually be raised within the Snap handler. Adds the given lazy i to the body of the dc stored in the   monad state. @Warning: This function is intentionally non-strict. If any pure 6 exceptions are raised by the expression creating the f,  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  dc9. 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 dc9. 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 qp state  object. The qp/ object in the Snap monad state after the call $ to localRequest will be unchanged.  Fetches the qp. from state and hands it to the given action.  Fetches the dc. from state and hands it to the given action.  Modifies the qp in the state to set the t 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 qp in the state to set the t > 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 j 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 k or   An exception being thrown. 5Terminate the HTTP session with the given exception. Runs a  monad action in the ' Iteratee IO' monad. lSee 8. Looks up a value for the given named parameter in the  qpC. If more than one value was entered for the given parameter name,  ! gloms the values together with:  m " "parameter name to look up See !. Convenience function to return  from the  qp 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. 'Causes the handler thread to be killed n seconds from now.  Returns an U6 action which you can use to reset the handling thread's  timeout value. IBCDEFGHIJKLMNOZ[\]^_`abdlIBCCDEFGHIEFGHIJKJKLONMMNOZ[\]^_`abdl  nEThe internal data type you use to build a routing tree. Matching is done unambiguously. o and p routes can have a fallback route:  For o:, the fallback is routed when there is nothing to capture  - For p$, 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. qporstBA 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  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 u, 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  as  it is. vwu nqporstvwu nropqqporstvwux'cjkprstuvxy|}~prstuvxy|}~cjkrstuvxy|}~jk'&xyz{|}EA collection of options for serving static files out of a directory. CFiles to look for when a directory is requested (e.g., index.html) >Handler to generate a directory listing if there is no index. CMap 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. (MIME type map to look up content types. AHandler 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. A type alias for MIME type "A type alias for dynamic handlers Gets a path from the p using  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. 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 ( ".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. IAn 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 = 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  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 GA very simple configuration for directory serving. This configuration  uses built-in MIME types from , and has no index files, , index generator, dynamic file handlers, or . @A reasonable default configuration for directory serving. This - configuration uses built-in MIME types from  , serves  common index files  index.html and  index.htm, but does not autogenerate < directory indexes, nor have any dynamic file handlers. The   will not do anything. EA more elaborate configuration for file serving. This configuration  uses built-in MIME types from , 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 , " which should be added as needed. $Files recognized as indexes include  index.html,  index.htm,   default.html,  default.htm,  home.html EServes static files from a directory using the default configuration  as given in . Directory to serve from AServes static files from a directory. Configuration options are  passed in a - that captures various choices about desired ' behavior. The relative path given in  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  HServes 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  don' t apply to A 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  path to file  JServes files out of the given directory, using no index files and default  MIME types. /The function name is obsolete. You should use  or  8 instead, which do similar things but with more options % and clearer, more consistent names. root directory  IServes files out of the given directory, with a given MIME type mapping. /The function name is obsolete. You should use  I instead, which offers more options and a clearer, more consistent name. 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. /The function name is obsolete. You should use   instead, which ? does the same thing but with a clearer, more consistent name.  path to file Same as  +, with control over the MIME mapping used. /The function name is obsolete. You should use   instead, which ? does the same thing but with a clearer, more consistent name. MIME type mapping  path to file                 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. Upload policy can be set on an "general" basis (using ), 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 / 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. ;All of the exceptions defined in this package inherit from  , so if you write  0 foo `catch` \(e :: FileUploadException) -> ... you can catch a , a , etc.  contains information about a "part" in a request uploaded  with Content-type: multipart/ form-data. IReads 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 c 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   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  $ and &), 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 , stipulates that you wish form inputs to be  placed in the  parameter map (using  ), and M a form input exceeds the maximum allowable size, this function will throw a  . 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) :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  (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  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  $ and &), 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 , stipulates that you wish form inputs to be  placed in the  parameter map (using  ), and M a form input exceeds the maximum allowable size, this function will throw a  . 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 GA 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 FDoes this upload policy stipulate that we want to treat parts without  filenames as form input?  JSet the upload policy for treating parts without filenames as form input. !AGet the maximum size of a form input which will be read into our   map. "ASet the maximum size of a form input which will be read into our   map. #Get the minimum rate (in bytes\second/ ) a client must maintain before  we kill the connection. $Set the minimum rate (in bytes\second/ ) a client must maintain before  we kill the connection. %GGet the amount of time which must elapse before we begin enforcing the  upload rate minimum &GSet the amount of time which must elapse before we begin enforcing the  upload rate minimum 'Get the "upload timeout".. Whenever input is received from the client, B the connection timeout is set this many seconds in the future. (Set the upload timeout. )#Disallows the file to be uploaded. *2Allows the file to be uploaded, with maximum size n. maximum size of form input file reading code boundary value part processor Given a .6 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  38 to split the input up into parts which match and parts  which don't, run the given f$ iteratee over each part and grab a  list of the resulting values.  !"#$%&'()* !"#$%&'()* !"#$%&'()* +Runs 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 c  that's contained within the  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 +,+,+, !"#$%&'()*+,-./.0.123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsttuvwxyz{|}~                   ! ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 67 8 9 : ; < =YZ[\>?@ABCDEFGHIJK L L M M N O P Q  R S T U VIWXIYZI[\IY]IY^_`abcdbefbghbgh i j k l m n o p qrst ursvwxywzy{|}{~}IW w                         I                               snap-core-0.5.4 Snap.IterateeSnap.Util.ReadableSnap.Internal.ParsingSnap.Internal.DebugSnap.Internal.Iteratee.DebugSnap.Internal.Http.Types Snap.TypesSnap.Util.FileServeSnap.Util.FileUploadsSnap.Util.GZip)Snap.Internal.Iteratee.BoyerMooreHorspoolSnap.Internal.TypesSnap.Internal.InstancesSnap.Internal.Routingenumerator-0.4.14Data.EnumeratorIteratee liftFoldM liftFoldL' liftFoldLpeekliftI liftTransisEOF checkDoneenumEOFsequencejoinI concatEnumsenumList printChunks<==<>==>$$==<<>>== catchError throwErrorrun_runcontinueyieldreturnIChunksEOFData.Enumerator.ListheadconsumemapStreamContinueYieldErrorStep runIteratee Enumerator EnumerateeReadablefromBS fullyParseparseNumspdigitletteruntilEOLcrlfspacespSpaces fieldCharsfieldCharTablepHeaderspWord pQuotedString isRFCTextmatchAllpAvPairspAvPair pParametertrimpValueWithParameterspContentTypeWithParameterspTokenisToken strictizedebug debugErrno debugIgnoredebugErrnoIgnoreInvalidRangeExceptionTooManyBytesReadExceptionRateTooSlowExceptionShortWriteException enumBuilderenumBSenumLBS skipToEof countBytesmkIterateeBufferunsafeBufferIterateeunsafeBufferIterateeWithBufferdropdrop'take takeExactlytakeNoMoreThanenumFileenumFilePartialmapEnummapIterjoinI' 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 HttpVersionMethodCONNECTOPTIONSTRACEDELETEPUTPOSTHEADGET HasHeaders updateHeadersheadersHeadersc_format_log_timec_format_http_timec_parse_http_time set_c_locale addHeader setHeader getHeaders getHeader deleteHeader rspBodyMap rspBodyToEnumrqParamrqModifyParams rqSetParam emptyResponsesetResponseBodysetResponseStatussetResponseCodemodifyResponseBodysetContentType addCookieaddResponseCookiegetResponseCookiegetResponseCookiesdeleteResponseCookiemodifyResponseCookiesetContentLengthclearContentLength formatLogTimeformatHttpTime parseHttpTimeparseToCompletion pUrlEscaped urlDecode urlEncodehexdfinishfromStrtoStrstatusReasonMapNoHandlerExceptionSnap MonadSnapliftSnaprunRequestBodygetRequestBodytransformRequestBody finishWithcatchFinishWithpassmethodmethodsdirpathpathArgifTop getRequest getResponse putResponse putRequest modifyRequestmodifyResponseredirect redirect'logError addToOutput writeBuilderwriteBSwriteLBS writeText writeLazyTextsendFilesendFilePartial localRequest withRequest withResponseipHeaderFilteripHeaderFilter' bracketSnapterminateConnectionrunSnapgetParam getParams getCookie readCookie setTimeoutgetTimeoutActionroute routeLocalDirectoryConfig indexFilesindexGeneratordynamicHandlers mimeTypes preServeHookMimeMap HandlerMap getSafePathdefaultMimeTypesdefaultIndexGeneratorsimpleDirectoryConfigdefaultDirectoryConfigfancyDirectoryConfigserveDirectoryserveDirectoryWith serveFile serveFileAs fileServe fileServe'fileServeSinglefileServeSingle'PartUploadPolicy UploadPolicyPolicyViolationExceptionpolicyViolationExceptionReasonBadPartExceptionbadPartExceptionReasonFileUploadExceptionPartInfo partFieldName partFileNamepartContentTypehandleFileUploadshandleMultipartfileUploadExceptionReasondefaultUploadPolicydoProcessFormInputssetProcessFormInputsgetMaximumFormInputSizesetMaximumFormInputSizegetMinimumUploadRatesetMinimumUploadRategetMinimumUploadSecondssetMinimumUploadSecondsgetUploadTimeoutsetUploadTimeoutdisallowallowWithMaximumSizewithCompressionwithCompression' checkComplete MatchInfoNoMatchMatch lookaheadmatches bmhEnumeratee streamLengthbUFSIZtake' _enumFile_enumFilePartialmaxMMapFileSize tooBigForMMapgetTimeblaze-builder-0.3.0.1'Blaze.ByteString.Builder.Internal.TypesBuilderbaseForeign.C.TypesCTimeConnectionTerminatedException SnapState _snapRequest _snapResponse _snapLogError_snapSetTimeoutunSnap SnapResult SnapValueEarlyTerminationPassOnProcessingGHC.BaseMonadControl.Applicative Alternative Control.Monad MonadPlusempty<|>ghc-prim GHC.TypesIOtransformers-0.2.2.0Control.Monad.IO.ClassMonadIOControl.Monad.Trans.ClassliftControl.Monad.Trans.State.LazyStateTsnapBind snapReturnsnapFailrethrowIfTermination snapTyConliftIterupdateContextPathpathWithsget mtl-2.0.1.0Control.Monad.State.Classgetsmodifymodifybytestring-0.9.2.0Data.ByteString.Internal ByteStringData.ByteString.Lazy.Internal text-0.11.1.5Data.Text.InternalTextData.Text.Lazy.Internal!MonadCatchIO-transformers-0.2.2.2Control.Monad.CatchIObracketfailevalSnapData.ByteString intercalateRouteCaptureDirNoRouteAction routeHeightrouteEarliestNCroute' splitPathpRouteRangeReqSuffixRangeReq _suffixLength _rangeFirst _rangeLastsnapIndexStyles lookupExtfileTypedefaultMimeType rangeParser checkRangeReqdbguriWithoutQueryStringqueryStringSuffix UploadedFilesUploadedFilesState _currentFile_alreadyReadFilesFile_maximumFileSizeprocessFormInputsmaximumFormInputSizemaximumNumberOfFormInputsminimumUploadRateminimumUploadSeconds uploadTimeoutWrappedFileUploadException_wrappedFileUploadException!_wrappedFileUploadExceptionReasonGenericFileUploadException!_genericFileUploadExceptionReason Data.EitherEitheruploadExceptionToExceptionuploadExceptionFromExceptioncaptureVariableOrReadFile fileReaderinternalHandleMultipartgetContentType getFieldName findParam processPart processPartseolpHeadersWithSeparator toHeaders mAX_HDRS_SIZEemptyUploadedFilesStatenewUploadedFilescleanupUploadedFilesopenFileForUploadcloseActiveFile eatException makeTempFileBadAcceptEncodingExceptioncompressibleMimeTypesgzipCompressioncompressCompression gcompress ccompresscompressEnumerator acceptParserparseAcceptEncoding