Hello community, here is the log from the commit of package ghc-wai for openSUSE:Factory checked in at 2015-07-08 06:59:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-wai (Old) and /work/SRC/openSUSE:Factory/.ghc-wai.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-wai" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-wai/ghc-wai.changes 2015-05-27 12:47:30.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-wai.new/ghc-wai.changes 2015-07-08 06:59:52.000000000 +0200 @@ -1,0 +2,5 @@ +Mon Jul 6 12:48:56 UTC 2015 - mimi.vx@gmail.com + +- update to 3.0.3.0 + +------------------------------------------------------------------- Old: ---- wai-3.0.2.3.tar.gz New: ---- wai-3.0.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-wai.spec ++++++ --- /var/tmp/diff_new_pack.h6Cb7o/_old 2015-07-08 06:59:53.000000000 +0200 +++ /var/tmp/diff_new_pack.h6Cb7o/_new 2015-07-08 06:59:53.000000000 +0200 @@ -15,17 +15,18 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + %global pkg_name wai %bcond_with tests -Name: ghc-%{pkg_name} -Version: 3.0.2.3 +Name: ghc-wai +Version: 3.0.3.0 Release: 0 Summary: Web Application Interface +License: MIT Group: System/Libraries -License: MIT Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -63,37 +64,29 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %check %if %{with tests} %cabal test %endif - %post devel %ghc_pkg_recache - %postun devel %ghc_pkg_recache - %files -f %{name}.files %defattr(-,root,root,-) %doc LICENSE - %files devel -f %{name}-devel.files %defattr(-,root,root,-) %doc README.md - %changelog ++++++ wai-3.0.2.3.tar.gz -> wai-3.0.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wai-3.0.2.3/Network/Wai.hs new/wai-3.0.3.0/Network/Wai.hs --- old/wai-3.0.2.3/Network/Wai.hs 2015-02-22 14:12:52.000000000 +0100 +++ new/wai-3.0.3.0/Network/Wai.hs 2015-07-05 07:08:07.000000000 +0200 @@ -71,10 +71,15 @@ , responseLBS , responseStream , responseRaw - -- * Response accessors + -- ** Response accessors , responseStatus , responseHeaders + -- ** Response modifiers , responseToStream + , mapResponseHeaders + -- * Middleware composition + , ifRequest + , modifyResponse ) where import Blaze.ByteString.Builder (Builder, fromLazyByteString) @@ -225,6 +230,13 @@ (s, h, \withBody -> withBody $ \sendChunk _flush -> sendChunk b) responseToStream (ResponseRaw _ res) = responseToStream res +-- | Apply the provided function to the response header list of the Response. +mapResponseHeaders :: (H.ResponseHeaders -> H.ResponseHeaders) -> Response -> Response +mapResponseHeaders f (ResponseFile s h b1 b2) = ResponseFile s (f h) b1 b2 +mapResponseHeaders f (ResponseBuilder s h b) = ResponseBuilder s (f h) b +mapResponseHeaders f (ResponseStream s h b) = ResponseStream s (f h) b +mapResponseHeaders _ r@(ResponseRaw _ _) = r + ---------------------------------------------------------------- -- | The WAI application. @@ -242,21 +254,6 @@ -- @ type Application = Request -> (Response -> IO ResponseReceived) -> IO ResponseReceived --- | Middleware is a component that sits between the server and application. It --- can do such tasks as GZIP encoding or response caching. What follows is the --- general definition of middleware, though a middleware author should feel --- free to modify this. --- --- As an example of an alternate type for middleware, suppose you write a --- function to load up session information. The session information is simply a --- string map \[(String, String)\]. A logical type signature for this middleware --- might be: --- --- @ loadSession :: ([(String, String)] -> Application) -> Application @ --- --- Here, instead of taking a standard 'Application' as its first argument, the --- middleware takes a function which consumes the session information as well. -type Middleware = Application -> Application -- | A default, blank request. -- @@ -279,6 +276,36 @@ , requestHeaderRange = Nothing } + +-- | Middleware is a component that sits between the server and application. It +-- can do such tasks as GZIP encoding or response caching. What follows is the +-- general definition of middleware, though a middleware author should feel +-- free to modify this. +-- +-- As an example of an alternate type for middleware, suppose you write a +-- function to load up session information. The session information is simply a +-- string map \[(String, String)\]. A logical type signature for this middleware +-- might be: +-- +-- @ loadSession :: ([(String, String)] -> Application) -> Application @ +-- +-- Here, instead of taking a standard 'Application' as its first argument, the +-- middleware takes a function which consumes the session information as well. +type Middleware = Application -> Application + + +-- | apply a function that modifies a response as a 'Middleware' +modifyResponse :: (Response -> Response) -> Middleware +modifyResponse f app req respond = app req $ respond . f + + +-- | conditionally apply a 'Middleware' +ifRequest :: (Request -> Bool) -> Middleware -> Middleware +ifRequest rpred middle app req | rpred req = middle app req + | otherwise = app req + + + -- | Get the request body as a lazy ByteString. However, do /not/ use any lazy -- I\/O, instead reading the entire body into memory strictly. -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/wai-3.0.2.3/wai.cabal new/wai-3.0.3.0/wai.cabal --- old/wai-3.0.2.3/wai.cabal 2015-02-22 14:12:52.000000000 +0100 +++ new/wai-3.0.3.0/wai.cabal 2015-07-05 07:08:07.000000000 +0200 @@ -1,5 +1,5 @@ Name: wai -Version: 3.0.2.3 +Version: 3.0.3.0 Synopsis: Web Application Interface. Description: Provides a common protocol for communication between web applications and web servers. description: API docs and the README are available at http://www.stackage.org/package/wai.