cgi 3001.3.0.2 → 3001.3.0.3
raw patch · 9 files changed
+87/−44 lines, 9 filesdep −QuickCheckdep −doctestdep ~basedep ~containersdep ~exceptionsnew-uploaderPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: QuickCheck, doctest
Dependency ranges changed: base, containers, exceptions, mtl, network, time
API changes (from Hackage documentation)
- Network.CGI.Monad: instance Control.Monad.Catch.MonadCatch m => Control.Monad.Error.Class.MonadError GHC.Exception.SomeException (Network.CGI.Monad.CGIT m)
+ Network.CGI.Monad: instance Control.Monad.Catch.MonadCatch m => Control.Monad.Error.Class.MonadError GHC.Exception.Type.SomeException (Network.CGI.Monad.CGIT m)
- Network.CGI: class Monad m => MonadIO (m :: * -> *)
+ Network.CGI: class Monad m => MonadIO (m :: Type -> Type)
- Network.CGI: data ContentType :: *
+ Network.CGI: data ContentType
- Network.CGI: liftIO :: MonadIO m => forall a. IO a -> m a
+ Network.CGI: liftIO :: MonadIO m => IO a -> m a
- Network.CGI.Compat: data Html :: *
+ Network.CGI.Compat: data Html
- Network.CGI.Protocol: newtype HeaderName :: *
+ Network.CGI.Protocol: newtype HeaderName
Files
- .hlint.yaml +14/−0
- CHANGELOG.md +19/−1
- Network/CGI.hs +0/−1
- Network/CGI/Accept.hs +9/−5
- Network/CGI/Monad.hs +11/−4
- README.md +28/−0
- cgi.cabal +6/−18
- src/DocTest.hs +0/−7
- src/DocTestMain.hs +0/−8
+ .hlint.yaml view
@@ -0,0 +1,14 @@+# .hlint.yaml++- ignore: {name: Avoid lambda}+- ignore: {name: Eta reduce}+- ignore: {name: Redundant $}+- ignore: {name: Redundant bracket}+- ignore: {name: Unused LANGUAGE pragma}+- ignore: {name: Use <$>}+- ignore: {name: Use fmap}+- ignore: {name: Use intercalate}+- ignore: {name: Use isJust}+- ignore: {name: Use Just}+- ignore: {name: Use LANGUAGE pragmas}+- ignore: {name: Wta reduce}
CHANGELOG.md view
@@ -2,6 +2,22 @@ All notable changes to this project will be documented in this file. This project adheres to the [Package Versioning Policy](https://wiki.haskell.org/Package_versioning_policy). +## [3001.3.0.3]+### Changed+- Bumped upper version bounds for containers and time.+- Updated to exceptions 0.10.x. This meant extending our `MonadMask` instance+ to provide the `generalBracket` method that was added to the class in recent+ versions of the exceptions library.+- The doctest suite would not work reliably with different versions of Cabal.+ Instead of going all out with a custom written build system to support it+ properly, we now run doctests as part of our CI builds but not as a part of+ the Cabal build any more.+- Fixed several compiler warnings in our code.++## [3001.3.0.2]+### Changed+- Bumped QuickCheck upper bound to version < 2.10+ ## [3001.3.0.1] ### Changed - Bumped doctest to version < 0.12@@ -42,7 +58,9 @@ - GHC 7.8.3 support [Unreleased]:-https://github.com/cheecheeo/haskell-cgi/compare/3001.3.0.1...HEAD+https://github.com/cheecheeo/haskell-cgi/compare/3001.3.0.2...HEAD+[3001.3.0.2]:+https://github.com/cheecheeo/haskell-cgi/compare/3001.3.0.1...3001.3.0.2 [3001.3.0.1]: https://github.com/cheecheeo/haskell-cgi/compare/3001.3.0.0...3001.3.0.1 [3001.3.0.0]:
Network/CGI.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE OverlappingInstances #-} ----------------------------------------------------------------------------- -- | -- Module : Network.CGI
Network/CGI/Accept.hs view
@@ -30,8 +30,12 @@ -- A bounded join-semilattice class Eq a => Acceptable a where includes :: a -> a -> Bool- top :: a+{- top :: a + TODO: This method is not exported from his module, so it cannot be used by+ code on the outside. It is not used inside of this module either. So,+ do we actually need it?+-} instance HeaderValue a => HeaderValue (Accept a) where parseHeaderValue = fmap Accept $ sepBy p (lexeme (char ',')) where p = do a <- parseHeaderValue@@ -74,7 +78,7 @@ includes x y = ctType x `starOrEqualTo` ctType y && ctSubtype x `starOrEqualTo` ctSubtype y && all (hasParameter y) (ctParameters x)- top = ContentType "*" "*" []+ -- top = ContentType "*" "*" [] hasParameter :: ContentType -> (String, String) -> Bool hasParameter t (k,v) = maybe False (==v) $ lookup k (ctParameters t)@@ -116,7 +120,7 @@ instance Acceptable Charset where Charset x `includes` Charset y = starOrEqualTo x y- top = Charset "*"+ -- top = Charset "*" -- -- ** Accept-Encoding@@ -141,7 +145,7 @@ instance Acceptable ContentEncoding where ContentEncoding x `includes` ContentEncoding y = starOrEqualTo x y- top = ContentEncoding "*"+ -- top = ContentEncoding "*" -- -- ** Accept-Language@@ -172,4 +176,4 @@ instance Acceptable Language where Language x `includes` Language y = x == "*" || x == y || (x `isPrefixOf` y && "-" `isPrefixOf` drop (length x) y)- top = Language "*"+ -- top = Language "*"
Network/CGI/Monad.hs view
@@ -1,5 +1,7 @@-{-# OPTIONS_GHC -fglasgow-exts #-}-{-# LANGUAGE CPP, DeriveDataTypeable #-}+{-# LANGUAGE CPP, DeriveDataTypeable, MultiParamTypeClasses #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -Wno-redundant-constraints #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Network.CGI.Monad@@ -28,11 +30,14 @@ throwCGI, catchCGI, tryCGI, handleExceptionCGI, ) where +#if !MIN_VERSION_base(4,6,0) import Prelude hiding (catch)+#endif+ import Control.Exception as Exception (SomeException) import Control.Applicative (Applicative(..)) import Control.Monad (liftM)-import Control.Monad.Catch (MonadCatch, MonadThrow, MonadMask, throwM, catch, try, mask, uninterruptibleMask)+import Control.Monad.Catch (MonadCatch, MonadThrow, MonadMask, throwM, catch, try, mask, uninterruptibleMask, generalBracket) import Control.Monad.Except (MonadError(..)) import Control.Monad.Reader (ReaderT(..), asks) import Control.Monad.Writer (WriterT(..), tell)@@ -57,7 +62,7 @@ -- | The CGIT monad transformer. newtype CGIT m a = CGIT { unCGIT :: ReaderT CGIRequest (WriterT Headers m) a } #if MIN_VERSION_base(4,7,0)- deriving (Typeable)+ deriving (Typeable) #else instance (Typeable1 m, Typeable a) => Typeable (CGIT m a) where@@ -90,6 +95,8 @@ instance MonadMask m => MonadMask (CGIT m) where mask a = CGIT $ mask $ \u -> unCGIT $ a $ CGIT . u . unCGIT uninterruptibleMask a = CGIT $ uninterruptibleMask $ \u -> unCGIT $ a $ CGIT . u . unCGIT+ generalBracket acquire release f = CGIT $+ generalBracket (unCGIT acquire) (\a b -> unCGIT (release a b)) (unCGIT . f) -- | The class of CGI monads. Most CGI actions can be run in -- any monad which is an instance of this class, which means that
+ README.md view
@@ -0,0 +1,28 @@+cgi+===++[](http://hackage.haskell.org/package/cgi)+[](http://stackage.org/lts/package/cgi)+[](http://stackage.org/nightly/package/cgi)+[](https://travis-ci.org/cheecheeo/haskell-cgi)++This is a Haskell library for writing CGI programs.+Its features include:++- Access to CGI parameters (e.g. form input) from both+ GET and POST requests.+- Access to CGI environment variables.+- Ability to set arbitrary response headers.+- Support for HTTP cookies.+- An efficient implementation of multipart/form-data+ using Data.ByteString. This allows for efficient+ handling of file uploads.+- Wrapper functions for compatibility with the old+ Network.CGI module.+- A CGI monad transformer.+- Basic exception handling and logging (these should be improved)+- Low-level run functions that allow using programs written with+ this package with protocols other than CGI, for example FastCGI.++On hackage: http://hackage.haskell.org/package/cgi+Source: https://github.com/cheecheeo/haskell-cgi
cgi.cabal view
@@ -1,5 +1,5 @@ Name: cgi-Version: 3001.3.0.2+Version: 3001.3.0.3 Copyright: Bjorn Bringert, John Chee, Andy Gill, Anders Kaseorg, Ian Lynagh, Erik Meijer, Sven Panne, Jeremy Shaw Category: Network@@ -13,8 +13,9 @@ Description: This is a Haskell library for writing CGI programs. Build-Type: Simple-extra-source-files: CHANGELOG.md+extra-source-files: README.md, CHANGELOG.md, .hlint.yaml Cabal-Version: >=1.8+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.2 source-repository head type: git@@ -44,12 +45,12 @@ Build-depends: parsec >= 2.0 && < 3.2,- exceptions < 0.9,+ exceptions >= 0.10 && < 0.11, xhtml >= 3000.0.0 && < 3000.3, bytestring < 0.11, base >= 4.5 && < 5,- time >= 1.5 && < 1.7,- containers < 0.6,+ time >= 1.5 && < 1.10,+ containers < 0.7, multipart >= 0.1.2 && < 0.2 If flag(network-uri) Build-depends: network-uri == 2.6.*, network == 2.6.*@@ -61,19 +62,6 @@ Else Build-depends: mtl>=2.2.1 && < 2.3--test-suite doctests- type: exitcode-stdio-1.0- ghc-options: -threaded- main-is: DocTestMain.hs- other-modules:- DocTest- hs-source-dirs: src- ghc-options: -Wall- build-depends:- base- , doctest >= 0.8 && < 0.12- , QuickCheck >= 2.8.1 && < 2.10 --Executable: printinput --Main-Is: printinput.hs
− src/DocTest.hs
@@ -1,7 +0,0 @@-module DocTest (- test- ) where-import Test.DocTest--test :: IO ()-test = doctest ["-iNetwork", "Network/CGI/Protocol.hs"]
− src/DocTestMain.hs
@@ -1,8 +0,0 @@-module Main (- main- ) where--import qualified DocTest--main :: IO ()-main = DocTest.test