maid 2009.8.25 → 2009.12.20
raw patch · 5 files changed
+45/−27 lines, 5 filesdep ~hack-contribdep ~hack-handler-happstackdep ~mps
Dependency ranges changed: hack-contrib, hack-handler-happstack, mps
Files
- LICENSE +27/−5
- Nemesis +1/−4
- changelog.md +7/−0
- maid.cabal +2/−2
- src/maid.hs +8/−16
LICENSE view
@@ -1,9 +1,31 @@ Copyright (c) 2009, Jinjing Wang+ All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:+Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met: -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.-Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.-Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Jinjing Wang nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Nemesis view
@@ -1,6 +1,3 @@-import MPS ((-))-import Prelude hiding ((-))- nemesis = do clean@@ -16,7 +13,7 @@ sh "cabal sdist" desc "start console"- task "i" (sh "ghci -isrc src/maid.hs")+ task "i" (sh "ghci -isrc -Wall src/maid.hs") desc "put all .hs files in manifest" task "manifest" - do
changelog.md view
@@ -1,3 +1,10 @@+2009.11.16+----------++### Feature++* use simple access logger to show remote host+ 2009.8.25 ---------
maid.cabal view
@@ -1,5 +1,5 @@ Name: maid-Version: 2009.8.25+Version: 2009.12.20 Build-type: Simple Synopsis: A simple static web server Description:@@ -18,6 +18,6 @@ Executable maid ghc-options: -Wall -threaded- build-depends: base >= 4 && < 5, mps >= 2009.8.18.1, loli >= 2009.8.18, haskell98, hack-contrib >= 2009.8.18, data-default, hack-handler-happstack, hack+ build-depends: base >= 4 && < 5, mps >= 2009.11.7, loli >= 2009.8.18, haskell98, hack-contrib >= 2009.12.20, data-default, hack-handler-happstack >= 2009.12.20, hack hs-source-dirs: src/ main-is: maid.hs
src/maid.hs view
@@ -5,12 +5,11 @@ import Hack.Handler.Happstack import System (getArgs) import MPS.TH (here)-import MPS (splash, tuple2, reject, strip, format_time, now, (/), (-))-import Control.Arrow ((>>>))+import MPS ((>), splash, tuple2, reject, strip, (/), (-)) import Data.Default (def)-import Hack.Contrib.Request (url)+import Hack.Contrib.Middleware.SimpleAccessLogger import Hack-import Prelude hiding ((/), (-))+import Prelude hiding ((/), (-), (>)) main :: IO () main = do@@ -22,7 +21,7 @@ } let { app =- log_access - try_index - loli - do+ simple_access_logger Nothing - try_index - loli - do public (Just ".") [""] mapM_ (splash mime) mimes }@@ -34,13 +33,6 @@ runWithConfig def {port} - app where- log_access app = \env -> do- time <- now- let time_format = "%Y-%m-%d %H:%M:%S"- time_stamp = format_time time_format time- putStrLn - time_stamp ++ " - " ++ url env- app env- try_index app = \env -> do r <- app env if status r == 404@@ -60,10 +52,10 @@ mimes :: [(String, String)] mimes = - lines - >>> map strip- >>> reject null- >>> map (words >>> tuple2)+ lines + > map strip+ > reject null+ > map (words > tuple2) - mime_data mime_data :: String