http-reverse-proxy 0.6.0.2 → 0.6.0.3
raw patch · 3 files changed
+11/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Network/HTTP/ReverseProxy.hs +6/−4
- http-reverse-proxy.cabal +1/−1
ChangeLog.md view
@@ -1,4 +1,8 @@ +## 0.6.0.3++* Fix a regression introduced in 0.6.0.2: wrong 'Content-Length' header is preserved for responses with encoded content. [#47](https://github.com/fpco/http-reverse-proxy/pull/47)+ ## 0.6.0.2 * Fix docker registry reverse proxying by preserving the 'Content-Length' response header to HTTP/2 and HEAD requests. [#45](https://github.com/fpco/http-reverse-proxy/pull/45)
Network/HTTP/ReverseProxy.hs view
@@ -54,7 +54,7 @@ import Data.IORef import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NE-import Data.Maybe (fromMaybe, listToMaybe)+import Data.Maybe (fromMaybe, isNothing, listToMaybe) import Data.Monoid (mappend, mconcat, (<>)) import Data.Set (Set) import qualified Data.Set as Set@@ -426,12 +426,14 @@ (awaitForever (\bs -> yield (Chunk $ fromByteString bs) >> yield Flush)) (wpsProcessBody wps req $ const () <$> res) src = bodyReaderSource $ HC.responseBody res- noChunked = HT.httpMajor (WAI.httpVersion req) >= 2 || WAI.requestMethod req == HT.methodHead+ headers = HC.responseHeaders res+ notEncoded = isNothing (lookup "content-encoding" headers)+ notChunked = HT.httpMajor (WAI.httpVersion req) >= 2 || WAI.requestMethod req == HT.methodHead sendResponse $ WAI.responseStream (HC.responseStatus res) (filter (\(key, v) -> not (key `Set.member` strippedHeaders) ||- key == "content-length" && (noChunked || v == "0"))- (HC.responseHeaders res))+ key == "content-length" && (notEncoded && notChunked || v == "0"))+ headers) (\sendChunk flush -> runConduit $ src .| conduit .| CL.mapM_ (\mb -> case mb of Flush -> flush
http-reverse-proxy.cabal view
@@ -1,5 +1,5 @@ name: http-reverse-proxy-version: 0.6.0.2+version: 0.6.0.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