-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A fast, iteratee-based, epoll-enabled web server for the Snap Framework -- -- This is the first developer prerelease of the Snap framework. Snap is -- a simple and fast web development framework and server written in -- Haskell. For more information or to download the latest version, you -- can visit the Snap project website at -- http://snapframework.com/. -- -- The Snap HTTP server is a high performance, epoll-enabled, -- iteratee-based web server library written in Haskell. Together with -- the snap-core library upon which it depends, it provides a -- clean and efficient Haskell programming interface to the HTTP -- protocol. -- -- Higher-level facilities for building web applications (like -- user/session management, component interfaces, data modeling, etc.) -- are planned but not yet implemented, so this release will mostly be of -- interest for those who: -- -- @package snap-server @version 0.3.1 module System.FastLogger -- | Holds the state for a logger. data Logger -- | Prepares a log message with the time prepended. timestampedLogEntry :: ByteString -> IO ByteString -- | Prepares a log message in "combined" format. combinedLogEntry :: ByteString -> Maybe ByteString -> ByteString -> Int -> Maybe Int64 -> Maybe ByteString -> ByteString -> IO ByteString -- | Creates a new logger, logging to the given file. If the file argument -- is "-", then log to stdout; if it's "stderr" then we log to stderr, -- otherwise we log to a regular file in append mode. The file is closed -- and re-opened every 15 minutes to facilitate external log rotation. newLogger :: FilePath -> IO Logger -- | Sends out a log message verbatim with a newline appended. Note: if you -- want a fancy log message you'll have to format it yourself (or use -- combinedLogEntry). logMsg :: Logger -> ByteString -> IO () -- | Kills a logger thread, causing any unwritten contents to be flushed -- out to disk stopLogger :: Logger -> IO () -- | This module exports the Config datatype which represents -- partially-specified configurations of "serve" functions which run -- Snap actions in IO. module Snap.Http.Server.Config -- | A record type which represents partial configurations (for -- httpServe) by wrapping all of its fields in a Maybe. -- Values of this type are usually constructed via its Monoid -- instance by doing something like: -- --
--   setPort 9000 mempty
--   
-- -- Any fields which are unspecified in the Config passed to -- httpServe (and this is the norm) are filled in with default -- values from defaultConfig. data MonadSnap m => Config m a -- | A data type to store the bind address and port to listen on. -- -- For SSL support, it also stores the path to the certificate in PEM -- format and the path to the private key in PEM format data ConfigListen ListenHttp :: ByteString -> Int -> ConfigListen ListenHttps :: ByteString -> Int -> FilePath -> FilePath -> ConfigListen -- | A data type to record which backend event loop should be used when -- serving data. data ConfigBackend ConfigSimpleBackend :: ConfigBackend ConfigLibEvBackend :: ConfigBackend -- | Returns a completely empty Config. Equivalent to mempty -- from Config's Monoid instance. emptyConfig :: MonadSnap m => Config m a -- | These are the default values for all the fields in Config. -- --
--   hostname     = "localhost"
--   listen       = []
--   accessLog    = "log/access.log"
--   errorLog     = "log/error.log"
--   locale       = "en_US"
--   backend      = Nothing (the backend is selected based on compile options)
--   compression  = True
--   verbose      = True
--   errorHandler = prints the error message
--   
defaultConfig :: MonadSnap m => Config m a -- | Completes a partial Config by filling in the unspecified values -- with the default values from defaultConfig. Also, if no -- listeners are specified, adds a http listener on 0.0.0.0:8000 completeConfig :: MonadSnap m => Config m a -> Config m a -- | This returns a Config gotten from parsing the options specified -- on the command-line. -- -- The Config parameter is just for specifying any default values -- which are to override those in defaultConfig. This is so the -- usage message can accurately inform the user what the default values -- for the options are. In most cases, you will probably just end up -- passing mempty for this parameter. -- -- On Unix systems, the locale is read from the LANG environment -- variable. commandLineConfig :: MonadSnap m => Config m a -> IO (Config m a) getHostname :: MonadSnap m => Config m a -> Maybe ByteString getListen :: MonadSnap m => Config m a -> [ConfigListen] getAccessLog :: MonadSnap m => Config m a -> Maybe (Maybe FilePath) getErrorLog :: MonadSnap m => Config m a -> Maybe (Maybe FilePath) getLocale :: MonadSnap m => Config m a -> Maybe String getBackend :: MonadSnap m => Config m a -> Maybe ConfigBackend getCompression :: MonadSnap m => Config m a -> Maybe Bool getVerbose :: MonadSnap m => Config m a -> Maybe Bool getErrorHandler :: MonadSnap m => Config m a -> Maybe (SomeException -> m ()) getOther :: MonadSnap m => Config m a -> Maybe a setHostname :: MonadSnap m => ByteString -> Config m a -> Config m a addListen :: MonadSnap m => ConfigListen -> Config m a -> Config m a setAccessLog :: MonadSnap m => Maybe FilePath -> Config m a -> Config m a setErrorLog :: MonadSnap m => Maybe FilePath -> Config m a -> Config m a setLocale :: MonadSnap m => String -> Config m a -> Config m a setBackend :: MonadSnap m => ConfigBackend -> Config m a -> Config m a setCompression :: MonadSnap m => Bool -> Config m a -> Config m a setVerbose :: MonadSnap m => Bool -> Config m a -> Config m a setErrorHandler :: MonadSnap m => (SomeException -> m ()) -> Config m a -> Config m a setOther :: MonadSnap m => a -> Config m a -> Config m a instance Eq ConfigBackend instance Show ConfigBackend instance MonadSnap m => Monoid (OptionData m a) instance MonadSnap m => Monoid (Config m a) instance MonadSnap m => Show (Config m a) instance Show ConfigListen -- | The Snap HTTP server is a high performance, epoll-enabled, -- iteratee-based web server library written in Haskell. Together with -- the snap-core library upon which it depends, it provides a -- clean and efficient Haskell programming interface to the HTTP -- protocol. module Snap.Http.Server -- | Starts serving HTTP requests using the given handler. Uses only the -- basic settings from the given config; error handling and compression -- are ignored. This function never returns; to shut down the HTTP -- server, kill the controlling thread. simpleHttpServe :: MonadSnap m => Config m a -> Snap () -> IO () -- | Starts serving HTTP requests using the given handler, with settings -- from the Config passed in. This function never returns; to shut -- down the HTTP server, kill the controlling thread. httpServe :: Config Snap () -> Snap () -> IO () -- | Starts serving HTTP using the given handler. The configuration is read -- from the options given on the command-line, as returned by -- commandLineConfig. This function never returns; to shut down -- the HTTP server, kill the controlling thread. quickHttpServe :: Snap () -> IO () -- | A short string describing the Snap server version snapServerVersion :: ByteString -- | Given a string like "en_US", this sets the locale to "en_US.UTF-8". -- This doesn't work on Windows. setUnicodeLocale :: String -> IO ()