mighttpd 0.4.1 → 0.4.2
raw patch · 8 files changed
+71/−23 lines, 8 filesdep ~parsec
Dependency ranges changed: parsec
Files
- Config.hs +1/−2
- File.hs +2/−2
- LogMsg.hs +6/−5
- Mighttpd.hs +5/−7
- Parsec.hs +52/−0
- URLMap.hs +1/−3
- mighttpd.cabal +3/−3
- mkindex.hs +1/−1
Config.hs view
@@ -2,9 +2,8 @@ module Config (Option(..), parseOption, defaultOption) where -import Control.Applicative ((<$>),(<$),(<*),(<*>),(*>)) import Data.List (isPrefixOf)-import Text.ParserCombinators.Parsec+import Parsec ----------------------------------------------------------------
File.hs view
@@ -22,7 +22,7 @@ progName = "Mighttpd" progVersion :: String-progVersion = "0.4.1"+progVersion = "0.4.2" progNameVersion :: String progNameVersion = progName ++ "/" ++ progVersion@@ -49,7 +49,7 @@ toPath :: ConvInfo -> FilePath -> Path toPath (CIFile dir) restPath = File $ dir </> restPath-toPath ci@(CICgi _ _) progParam = PathCGI $ CGI {+toPath ci@(CICgi _ _) progParam = PathCGI CGI { progPath = prog , scriptName = scriptname , pathInfo = path
LogMsg.hs view
@@ -3,8 +3,9 @@ errorMsg, warnMsg, noticeMsg, infoMsg, debugMsg) where -import System.Log.Logger+import Data.Maybe import System.Log.Handler.Syslog+import System.Log.Logger errorMsg :: String -> IO () errorMsg = errorM rootLoggerName@@ -42,12 +43,12 @@ updateGlobalLogger rootLoggerName (setLevel level) toLevel :: String -> Priority-toLevel str = maybe (error ("Unknown level " ++ show str))- id (lookup str levelDB)+toLevel str = fromMaybe (error ("Unknown level " ++ show str))+ (lookup str levelDB) toFacility :: String -> Facility-toFacility str = maybe (error ("Unknown facility " ++ show str))- id (lookup str facilityDB)+toFacility str = fromMaybe (error ("Unknown facility " ++ show str))+ (lookup str facilityDB) levelDB :: [(String, Priority)] levelDB = [
Mighttpd.hs view
@@ -11,7 +11,7 @@ import Network.Web.Server import System.Environment import System.Exit-import System.Posix.Daemonize+import System.Posix.Daemonize (daemonize) import URLMap ----------------------------------------------------------------@@ -65,7 +65,7 @@ makeInitHook :: Option -> IO () makeInitHook opt =- if opt_debug_mode opt == True+ if opt_debug_mode opt then initLog progName "" (opt_log_level opt) StdErr else initLog progName (opt_syslog_facility opt) (opt_log_level opt) SysLog @@ -77,8 +77,6 @@ makeStartedHook :: Option -> IO () makeStartedHook opt =- if opt_debug_mode opt == True- then do- initLog progName "" (opt_log_level opt) StdErr- else do- initLog progName (opt_syslog_facility opt) (opt_log_level opt) SysLog+ if opt_debug_mode opt+ then initLog progName "" (opt_log_level opt) StdErr+ else initLog progName (opt_syslog_facility opt) (opt_log_level opt) SysLog
+ Parsec.hs view
@@ -0,0 +1,52 @@+{-# LANGUAGE CPP #-}++#ifndef MIN_VERSION_parsec+#define MIN_VERSION_parsec(x,y,z) 0+#endif++#if MIN_VERSION_parsec(3,0,0)+module Parsec (+ module Control.Applicative+ , module Text.Parsec+ , module Text.Parsec.String+ ) where++import Control.Applicative hiding (many,optional,(<|>))+import Text.Parsec+import Text.Parsec.String+#else+module Parsec (+ module Text.ParserCombinators.Parsec+ , (<$>), (<$), (<*>), (<*), (*>), pure+ ) where++import Control.Monad (ap, liftM)+import Text.ParserCombinators.Parsec++{-+ GenParser cannot be an instance of Applicative and Alternative+ due to the overlapping instances error, sigh!+-}++(<$>) :: Monad m => (a -> b) -> m a -> m b+(<$>) = liftM++(<$) :: Monad m => a -> m b -> m a+a <$ m = m >> return a++(<*>) :: Monad m => m (a -> b) -> m a -> m b+(<*>) = ap++(*>) :: Monad m => m a -> m b -> m b+(*>) = (>>)++(<*) :: Monad m => m a -> m b -> m a+m1 <* m2 = do x <- m1+ m2+ return x++pure :: Monad m => a -> m a+pure = return++infixl 4 <$>, <$, <*>, <*, *>+#endif
URLMap.hs view
@@ -2,11 +2,9 @@ module URLMap (parseURLMap, URL, URLMap, ConvInfo(..)) where -import Control.Applicative ((<$>),(<$),(<*),(<*>),(*>),pure) import qualified Data.ByteString.Char8 as S import Network.Web.URI-import Text.Parsec-import Text.Parsec.String+import Parsec type URL = String data ConvInfo = CIFile String | CICgi { progDir :: String
mighttpd.cabal view
@@ -1,5 +1,5 @@ Name: mighttpd-Version: 0.4.1+Version: 0.4.2 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3@@ -11,7 +11,7 @@ Category: Network Cabal-Version: >= 1.6 Build-Type: Simple-Extra-Source-Files: Config.hs LogMsg.hs Setup.hs File.hs URLMap.hs+Extra-Source-Files: Config.hs LogMsg.hs Setup.hs File.hs URLMap.hs Parsec.hs Data-Files: sample.conf sample.map Executable mighttpd Main-Is: Mighttpd.hs@@ -20,7 +20,7 @@ else GHC-Options: -Wall -O2 Ghc-Prof-Options: -prof -auto-all -caf-all- Build-Depends: base >= 4 && < 5, parsec >= 3,+ Build-Depends: base >= 4 && < 5, parsec, c10k, hslogger, webserver, bytestring, filepath, haskell98, hdaemonize, directory, unix, time, network Executable mkindex
mkindex.hs view
@@ -56,7 +56,7 @@ | isDirectory st = " - " | otherwise = sizeFormat . fromIntegral . fileSize $ st where- sizeFormat siz = unit siz [' ','K','M','G','T']+ sizeFormat siz = unit siz " KMGT" unit _ [] = undefined unit s [u] = format s u unit s (u:us)