hack-contrib 2010.2.25 → 2010.9.28
raw patch · 4 files changed
+49/−38 lines, 4 filesdep −pureMD5PVP ok
version bump matches the API change (PVP)
Dependencies removed: pureMD5
API changes (from Hackage documentation)
- Hack.Contrib.Middleware.ETag: etag :: Middleware
+ Hack.Contrib.Middleware.Cascade: cascade :: [Application] -> Application
Files
- LICENSE +27/−5
- hack-contrib.cabal +6/−6
- src/Hack/Contrib/Middleware/Cascade.hs +16/−0
- src/Hack/Contrib/Middleware/ETag.hs +0/−27
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.
hack-contrib.cabal view
@@ -1,16 +1,16 @@ Name: hack-contrib-Version: 2010.2.25+Version: 2010.9.28 Build-type: Simple Synopsis: Hack contrib Description: Common middlewares and utilities that helps working with Hack License: BSD3 License-file: LICENSE-Author: Wang, Jinjing-Maintainer: Wang, Jinjing <nfjinjing@gmail.com>+Author: Jinjing Wang+Maintainer: Jinjing Wang <nfjinjing@gmail.com> Build-Depends: base Cabal-version: >= 1.2 category: Web-homepage: http://github.com/nfjinjing/hack-contrib/tree/master+homepage: http://github.com/nfjinjing/hack-contrib data-files: readme.md, changelog.md library@@ -28,7 +28,6 @@ , bytestring , data-default >= 0.2 , time- , pureMD5 , mps >= 2010.1.26 , hack >= 2009.10.30 , utf8-string@@ -43,7 +42,7 @@ Hack.Contrib.Middleware.ContentLength Hack.Contrib.Middleware.ContentType Hack.Contrib.Middleware.Debug- Hack.Contrib.Middleware.ETag+ -- Hack.Contrib.Middleware.ETag Hack.Contrib.Middleware.File Hack.Contrib.Middleware.Head Hack.Contrib.Middleware.Inspect@@ -59,6 +58,7 @@ Hack.Contrib.Middleware.UTF8Body -- Hack.Contrib.Middleware.Lambda -- Hack.Contrib.Middleware.Lucky+ Hack.Contrib.Middleware.Cascade Hack.Contrib.Mime Hack.Contrib.Request Hack.Contrib.Response
+ src/Hack/Contrib/Middleware/Cascade.hs view
@@ -0,0 +1,16 @@+module Hack.Contrib.Middleware.Cascade (cascade) where++import Prelude ()+import MPS.Env+import Hack+import Data.Default++cascade :: [Application] -> Application+cascade [] = const - return def { status = 404 }+cascade (x:xs) = \env -> do+ r <- x env+ if r.status == 404+ then+ cascade xs env+ else+ return r
− src/Hack/Contrib/Middleware/ETag.hs
@@ -1,27 +0,0 @@--- | Stolen from rack-contrib: Automatically sets the ETag header on all --- String bodies--module Hack.Contrib.Middleware.ETag (etag) where--import Data.Digest.Pure.MD5-import Hack-import Hack.Contrib.Constants-import Hack.Contrib.Response-import MPS.Light-import Prelude hiding ((.), (^), (>), (-))----etag :: Middleware-etag app = \env -> do- r <- app env- - if r.has_header _ETag- then r.return- else r.set_header _ETag (r.tag) .return- - where - tag = - body- > md5- > show