packages feed

http-reverse-proxy 0.4.2 → 0.4.3

raw patch · 4 files changed

+18/−6 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Network.HTTP.ReverseProxy: instance Default LocalWaiProxySettings
- Network.HTTP.ReverseProxy: instance Default WaiProxySettings
- Network.HTTP.ReverseProxy: pdHost :: ProxyDest -> !ByteString
- Network.HTTP.ReverseProxy: pdPort :: ProxyDest -> !Int
+ Network.HTTP.ReverseProxy: WPRModifiedRequestSecure :: Request -> ProxyDest -> WaiProxyResponse
+ Network.HTTP.ReverseProxy: WPRProxyDestSecure :: ProxyDest -> WaiProxyResponse
+ Network.HTTP.ReverseProxy: [pdHost] :: ProxyDest -> !ByteString
+ Network.HTTP.ReverseProxy: [pdPort] :: ProxyDest -> !Int
+ Network.HTTP.ReverseProxy: instance Data.Default.Class.Default Network.HTTP.ReverseProxy.LocalWaiProxySettings
+ Network.HTTP.ReverseProxy: instance Data.Default.Class.Default Network.HTTP.ReverseProxy.WaiProxySettings

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.4.3++* Allow proxying to HTTPS servers. [#15](https://github.com/fpco/http-reverse-proxy/pull/15)+ ## 0.4.2  *  Add configurable timeouts [#8](https://github.com/fpco/http-reverse-proxy/pull/8)
Network/HTTP/ReverseProxy.hs view
@@ -148,6 +148,8 @@                         -- ^ Send to the given destination.                         --                         -- Since 0.2.0+                      | WPRProxyDestSecure ProxyDest+                        -- ^ Send to the given destination via HTTPS.                       | WPRModifiedRequest WAI.Request ProxyDest                         -- ^ Send to the given destination, but use the given                         -- modified Request for computing the reverse-proxied@@ -156,6 +158,9 @@                         -- user.                         --                         -- Since 0.2.0+                      | WPRModifiedRequestSecure WAI.Request ProxyDest+                        -- ^ Same as WPRModifiedRequest but send to the+                        -- given destination via HTTPS.                       | WPRApplication WAI.Application                         -- ^ Respond with the given WAI Application.                         --@@ -336,8 +341,10 @@     let edest =             case edest' of                 WPRResponse res -> Left $ \_req -> ($ res)-                WPRProxyDest pd -> Right (pd, req0)-                WPRModifiedRequest req pd -> Right (pd, req)+                WPRProxyDest pd -> Right (pd, req0, False)+                WPRProxyDestSecure pd -> Right (pd, req0, True)+                WPRModifiedRequest req pd -> Right (pd, req, False)+                WPRModifiedRequestSecure req pd -> Right (pd, req, True)                 WPRApplication app -> Left app         timeBound us f =             timeout us f >>= \case@@ -345,7 +352,7 @@                 Nothing -> sendResponse $ WAI.responseLBS HT.status500 [] "timeBound"     case edest of         Left app -> maybe id timeBound (lpsTimeBound lps) $ app req0 sendResponse-        Right (ProxyDest host port, req) -> tryWebSockets wps host port req sendResponse $ do+        Right (ProxyDest host port, req, secure) -> tryWebSockets wps host port req sendResponse $ do             let req' = def                     { HC.method = WAI.requestMethod req                     , HC.host = host@@ -355,6 +362,7 @@                     , HC.requestHeaders = fixReqHeaders wps req                     , HC.requestBody = body                     , HC.redirectCount = 0+                    , HC.secure = secure                     , HC.checkStatus = \_ _ _ -> Nothing                     , HC.responseTimeout = lpsTimeBound lps                     }
http-reverse-proxy.cabal view
@@ -1,5 +1,5 @@ name:                http-reverse-proxy-version:             0.4.2+version:             0.4.3 synopsis:            Reverse proxy HTTP requests, either over raw sockets or with WAI description:         Provides a simple means of reverse-proxying HTTP requests. The raw approach uses the same technique as leveraged by keter, whereas the WAI approach performs full request/response parsing via WAI and http-conduit. homepage:            https://github.com/fpco/http-reverse-proxy@@ -15,7 +15,7 @@ library   exposed-modules:     Network.HTTP.ReverseProxy   other-modules:       Paths_http_reverse_proxy-  build-depends:       base                   >= 4         && < 5+  build-depends:       base                   >= 4.6    && < 5                      , monad-control          >= 0.3                      , lifted-base            >= 0.1                      , text                   >= 0.11
test/main.hs view
@@ -46,7 +46,7 @@ getPort :: IO Int getPort = do     port <- I.atomicModifyIORef nextPort $ \p -> (p + 1, p)-    esocket <- try $ bindPortTCP port "*4"+    esocket <- try $ bindPortTCP port "127.0.0.1"     case esocket of         Left (_ :: IOException) -> getPort         Right socket -> do