packages feed

maid 2009.7.24.1 → 2009.7.25

raw patch · 4 files changed

+39/−7 lines, 4 filesdep +hack

Dependencies added: hack

Files

changelog.md view
@@ -1,3 +1,11 @@+2009.7.25+--------++### Fix++* proper css content-type+* check "index.html" "index.htm" as well+ 2009.7.24.1 ----------- 
maid.cabal view
@@ -1,5 +1,5 @@ Name:                 maid-Version:              2009.7.24.1+Version:              2009.7.25 Build-type:           Simple Synopsis:             A simple static web server Description:@@ -18,6 +18,6 @@  Executable            maid   ghc-options:        -Wall-  build-depends:      base >= 4 && < 5, mps, loli, hack-handler-happstack, haskell98, hack-contrib, data-default+  build-depends:      base >= 4 && < 5, mps, loli, hack-handler-happstack, haskell98, hack-contrib, data-default, hack   hs-source-dirs:     src/   main-is:            maid.hs
readme.md view
@@ -19,3 +19,8 @@       maid 5000++note+----++use the git version
src/maid.hs view
@@ -5,10 +5,12 @@ import Hack.Handler.Happstack (runWithConfig, port) import System (getArgs) import MPS.TH (here)-import MPS (splash, tuple2, reject, strip, format_time, now)+import MPS (splash, tuple2, reject, strip, format_time, now, (/)) import Control.Arrow ((>>>)) import Data.Default (def) import Hack.Contrib.Request (url)+import Hack+import Prelude hiding ((/))  main :: IO () main = do@@ -20,7 +22,7 @@     }      let { app =-    log_access $ loli $ do+    log_access $ try_index $ loli $ do       public (Just ".") [""]       mapM_ (splash mime) mimes     }@@ -36,8 +38,25 @@       time <- now       let time_format = "%Y-%m-%d %H:%M:%S"           time_stamp = format_time time_format time-      putStrLn $ time_stamp ++ " - " ++ url env+      putStrLn $ time_stamp ++ "  -  " ++ url env       app env+      +    try_index app = \env -> do+      r <- app env+      if status r == 404+        then do+          r' <- app (env {pathInfo = pathInfo env / "index.html"})+          if status r' == 404+            then do+              r'' <- app (env {pathInfo = pathInfo env / "index.htm"})+              if status r'' == 404+                then return r+                else return r''+            else+              return r'+        else+          return r+    mimes :: [(String, String)] mimes = @@ -136,8 +155,8 @@ crt     application/x-x509-user-cert csh     application/x-csh csh     text/x-script.csh-css     application/x-pointplus css     text/css+css     application/x-pointplus cxx     text/plain dcr     application/x-director deepv   application/x-deepv@@ -677,8 +696,8 @@ xlw     application/x-excel xlw     application/x-msexcel xm      audio/xm-xml     application/xml xml     text/xml+xml     application/xml xmz     xgl/movie xpix    application/x-vnd.ls-xpix xpm     image/x-xpixmap