haxy 1.0 → 1.0.1
raw patch · 3 files changed
+17/−14 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG +3/−0
- Network/HTTP/Proxy/Server.hs +9/−9
- haxy.cabal +5/−5
CHANGELOG view
@@ -1,3 +1,6 @@+=1.0.1=+* Fixed a bug where request is bypassed. Thanks Scott Peter Johnson!+ =1.0= * Changed the settings to use the Logger from http-server. * The default logger is now http-server's default logger.
Network/HTTP/Proxy/Server.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE ScopedTypeVariables #-} -- | A library for programming custom proxy servers.-module Network.HTTP.Proxy.Server (proxyMain +module Network.HTTP.Proxy.Server (proxyMain ,Settings (..) ,Cache (..) ,Default(..)) where@@ -69,25 +69,25 @@ -- 'responseModifier' hook, record in cache and return Nothing -> do myLogInfo "Cache miss: forwarding the request"- response <- fetch request+ response <- fetch modRequest myLogInfo "Modifying the response" modResponse <- lift $ responseModifier settings request response myLogInfo "Caching the modified response"- lift $ recordInCache (cache settings) request modResponse + lift $ recordInCache (cache settings) request modResponse return modResponse- + fetch :: HStream s => Request s -> ProxyResponse s fetch request = do result <- lift $ simpleHTTP request- case result of + case result of Left err -> do myLogError $ "Connection error while fetching an external resource: " ++ show err lift errorInternalServerError Right rsp -> return rsp- --- | Proxy server settings -data Settings s = ++-- | Proxy server settings+data Settings s = Settings {requestModifier :: Request s -> IO (Request s) -- ^ A function for modifying requests. Will be called for -- each request received; the modified request will be@@ -134,7 +134,7 @@ instance Default (Cache s) where def = Cache {queryCache = return . const Nothing ,recordInCache = \_ -> return . const ()}- + -- |A generic 500 response errorInternalServerError :: HStream s => IO (Response s) errorInternalServerError = return $ err_response InternalServerError
haxy.cabal view
@@ -1,14 +1,14 @@ Name: haxy-Version: 1.0+Version: 1.0.1 Synopsis: A simple HTTP proxy server library-Description: A library for writing HTTP proxy servers with the focus on simplicity, flexibility and modularity. Allows arbitrary transformations on requests and responses and custom caching methods. It's up to the user to make sure that the message transformations are consistent with the HTTP specification. The executable program is a simple non-caching identity proxy and is used for testing the library.+Description: A library for writing HTTP proxy servers with the focus on simplicity, flexibility and modularity. Allows arbitrary transformations on requests and responses and custom caching methods. It's up to the user to make sure that the message transformations are consistent with the HTTP specification. Note that the package versions follow Semantic Versioning model (semver.org). License: BSD3 License-file: LICENSE Author: Andrey Chudnov Maintainer: Andrey Chudnov <oss@chudnov.com> Homepage: http://github.com/achudnov/haxy Bug-reports: http://github.com/achudnov/haxy/issues-Copyright: (c) 2012-2014 Stevens Institute of Technology+Copyright: (c) 2012-2015 Stevens Institute of Technology Category: Web Build-type: Simple Stability: Stable@@ -23,11 +23,11 @@ source-repository this type: git location: git://github.com/achudnov/haxy.git- tag: 1.0+ tag: 1.0.1 Library Exposed-modules: Network.HTTP.Proxy.Server- Build-depends: http-server >= 1.0.4 && < 1.1+ Build-depends: http-server >= 1.0.6 && < 1.1 , HTTP >= 4000.2.0 && < 5000 , base >= 4.3.1.0 && < 5 , url >= 2.1.2 && < 2.2