|
| Happstack.Server.HTTP.FileServe |
|
|
|
|
| Description |
| File Serving functions
|
|
| Synopsis |
|
| type MimeMap = Map String String | | | mimeTypes :: MimeMap | | | asContentType :: Monad m => String -> FilePath -> m String | | | guessContentType :: MimeMap -> FilePath -> Maybe String | | | guessContentTypeM :: Monad m => MimeMap -> FilePath -> m String | | | sendFileResponse :: String -> FilePath -> Maybe (CalendarTime, Request) -> Integer -> Integer -> Response | | | lazyByteStringResponse :: String -> ByteString -> Maybe (CalendarTime, Request) -> Integer -> Integer -> Response | | | strictByteStringResponse :: String -> ByteString -> Maybe (CalendarTime, Request) -> Integer -> Integer -> Response | | | filePathSendFile :: (ServerMonad m, MonadIO m) => String -> FilePath -> m Response | | | filePathLazy :: (ServerMonad m, MonadIO m) => String -> FilePath -> m Response | | | filePathStrict :: (ServerMonad m, MonadIO m) => String -> FilePath -> m Response | | | serveFile :: (ServerMonad m, FilterMonad Response m, MonadIO m) => (FilePath -> m String) -> FilePath -> m Response | | | serveFileUsing :: (ServerMonad m, FilterMonad Response m, MonadIO m) => (String -> FilePath -> m Response) -> (FilePath -> m String) -> FilePath -> m Response | | | fileServe' :: (WebMonad Response m, ServerMonad m, FilterMonad Response m, MonadIO m) => (String -> FilePath -> m Response) -> (FilePath -> m String) -> [FilePath] -> FilePath -> m Response | | | fileServe :: (WebMonad Response m, ServerMonad m, FilterMonad Response m, MonadIO m) => [FilePath] -> FilePath -> m Response | | | fileServeLazy :: (WebMonad Response m, ServerMonad m, FilterMonad Response m, MonadIO m) => [FilePath] -> FilePath -> m Response | | | fileServeStrict :: (WebMonad Response m, ServerMonad m, FilterMonad Response m, MonadIO m) => [FilePath] -> FilePath -> m Response | | | blockDotFiles :: (Request -> IO Response) -> Request -> IO Response | | | defaultIxFiles :: [String] | | | doIndex :: (ServerMonad m, FilterMonad Response m, MonadIO m) => [String] -> MimeMap -> String -> m Response | | | doIndex' :: (ServerMonad m, FilterMonad Response m, MonadIO m) => (String -> FilePath -> m Response) -> (FilePath -> m String) -> [String] -> String -> m Response | | | doIndexLazy :: (ServerMonad m, FilterMonad Response m, MonadIO m) => [String] -> MimeMap -> String -> m Response | | | doIndexStrict :: (ServerMonad m, FilterMonad Response m, MonadIO m) => [String] -> MimeMap -> String -> m Response | | | errorwrapper :: (MonadIO m, MonadPlus m, FilterMonad Response m) => String -> String -> m Response | | | isDot :: String -> Bool |
|
|
|
| Content-Type / Mime-Type
|
|
|
|
|
| Ready collection of common mime types.
Except for the first two entries, the mappings come from an Ubuntu 8.04 etcmime.types file.
|
|
|
|
|
|
|
|
| Low-Level
|
|
|
| :: String | content-type string
| | -> FilePath | file path for content to send
| | -> Maybe (CalendarTime, Request) | mod-time for the handle (MUST NOT be later than server's time of message origination), incoming request (used to check for if-modified-since header)
| | -> Integer | offset into Handle
| | -> Integer | number of bytes to send
| | -> Response | | | Use sendFile to send the contents of a Handle
|
|
|
|
| :: String | content-type string (e.g. "text/plain; charset=utf-8")
| | -> ByteString | lazy bytestring content to send
| | -> Maybe (CalendarTime, Request) | mod-time for the bytestring, incoming request (used to check for if-modified-since header)
| | -> Integer | offset into the bytestring
| | -> Integer | number of bytes to send (offset + count must be less than or equal to the length of the bytestring)
| | -> Response | | | Send the contents of a Lazy ByteString
|
|
|
| strictByteStringResponse | Source |
|
| :: String | content-type string (e.g. "text/plain; charset=utf-8")
| | -> ByteString | lazy bytestring content to send
| | -> Maybe (CalendarTime, Request) | mod-time for the bytestring, incoming request (used to check for if-modified-since header)
| | -> Integer | offset into the bytestring
| | -> Integer | number of bytes to send (offset + count must be less than or equal to the length of the bytestring)
| | -> Response | | | Send the contents of a Lazy ByteString
|
|
|
|
| :: (ServerMonad m, MonadIO m) | | | => String | content-type string
| | -> FilePath | path to file on disk
| | -> m Response | | Send the specified file with the specified mime-type using sendFile()
NOTE: assumes file exists and is readable by the server. See serveFileUsing.
WARNING: No security checks are performed.
|
|
|
|
| :: (ServerMonad m, MonadIO m) | | | => String | content-type string
| | -> FilePath | path to file on disk
| | -> m Response | | Send the specified file with the specified mime-type using Lazy ByteStrings
NOTE: assumes file exists and is readable by the server. See serveFileUsing.
WARNING: No security checks are performed.
|
|
|
|
| :: (ServerMonad m, MonadIO m) | | | => String | content-type string
| | -> FilePath | path to file on disk
| | -> m Response | | Send the specified file with the specified mime-type using Lazy ByteStrings
NOTE: assumes file exists and is readable by the server. See serveFileUsing.
WARNING: No security checks are performed.
|
|
|
| High-Level
|
|
| Serving a single file
|
|
|
| Alias for serveFileUsing filePathSendFile
|
|
|
|
|
| Serving files from a directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Other
|
|
|
| Prevents files of the form '.foo' or 'bar/.foo' from being served
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Returns True if the given String either starts with a . or is of the form
foo/.bar, e.g. the typical *nix convention for hidden files.
|
|
| Produced by Haddock version 2.6.1 |