summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaelSnoyman <>2014-06-20 03:19:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2014-06-20 03:19:00 (GMT)
commitc7c345661fbfae54b4cebcf8982d4be1f51c7c1e (patch)
tree12f2c6674c8d56a5649943beb7f1e6ce2af21245
parent5242da6d5d6d9adffb5e82b2621926ede7f9a3e6 (diff)
version 2.1.2.32.1.2.3
-rw-r--r--http-conduit.cabal6
-rw-r--r--test/main.hs28
2 files changed, 27 insertions, 7 deletions
diff --git a/http-conduit.cabal b/http-conduit.cabal
index 88bb314..b1a940a 100644
--- a/http-conduit.cabal
+++ b/http-conduit.cabal
@@ -1,5 +1,5 @@
name: http-conduit
-version: 2.1.2.2
+version: 2.1.2.3
license: BSD3
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>
@@ -29,8 +29,8 @@ library
, conduit >= 0.5.5 && < 1.2
, http-types >= 0.7
, lifted-base >= 0.1
- , http-client >= 0.3.2 && < 0.4
- , http-client-tls
+ , http-client >= 0.3.3.2 && < 0.4
+ , http-client-tls >= 0.2.1.2
, monad-control
, mtl
exposed-modules: Network.HTTP.Conduit
diff --git a/test/main.hs b/test/main.hs
index 7c631aa..d715452 100644
--- a/test/main.hs
+++ b/test/main.hs
@@ -9,7 +9,7 @@ import Test.HUnit
import Network.Wai hiding (requestBody)
import Network.Wai.Conduit (responseSource, sourceRequestBody)
import qualified Network.Wai as Wai
-import Network.Wai.Handler.Warp (runSettings, defaultSettings, settingsPort, settingsBeforeMainLoop)
+import Network.Wai.Handler.Warp (runSettings, defaultSettings, settingsPort, settingsBeforeMainLoop, Settings, setTimeout)
import Network.HTTP.Conduit hiding (port)
import qualified Network.HTTP.Conduit as NHC
import Network.HTTP.Client.MultipartFormData
@@ -117,14 +117,20 @@ withApp :: (Wai.Request -> IO Wai.Response) -> (Int -> IO ()) -> IO ()
withApp app' f = withApp' (const app') f
withApp' :: (Int -> Wai.Request -> IO Wai.Response) -> (Int -> IO ()) -> IO ()
-withApp' app' f = do
+withApp' = withAppSettings id
+
+withAppSettings :: (Settings -> Settings)
+ -> (Int -> Wai.Request -> IO Wai.Response)
+ -> (Int -> IO ())
+ -> IO ()
+withAppSettings modSettings app' f = do
port <- getPort
baton <- newEmptyMVar
bracket
- (forkIO $ runSettings defaultSettings
+ (forkIO $ runSettings (modSettings defaultSettings
{ settingsPort = port
, settingsBeforeMainLoop = putMVar baton ()
- } (app'' port) `onException` putMVar baton ())
+ }) (app'' port) `onException` putMVar baton ())
killThread
(const $ takeMVar baton >> f port)
where
@@ -414,6 +420,20 @@ main = withSocketsDo $ do
_ <- http req man
return ()
+ it "reuse/connection close tries again" $ do
+ withAppSettings (setTimeout 1) (const app) $ \port -> do
+ req <- parseUrl $ "http://localhost:" ++ show port
+ withManager $ \man -> do
+ res1 <- httpLbs req man
+ liftIO $ threadDelay 3000000
+ res2 <- httpLbs req man
+ let f res = res
+ { NHC.responseHeaders = filter (not . isDate) (NHC.responseHeaders res)
+ }
+ isDate ("date", _) = True
+ isDate _ = False
+ liftIO $ f res2 `shouldBe` f res1
+
withCApp :: (Data.Conduit.Network.AppData -> IO ()) -> (Int -> IO ()) -> IO ()
withCApp app' f = do
port <- getPort