Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions http-client-tls/Network/HTTP/Client/TLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ mkManagerSettingsContext' set mcontext tls sockHTTP sockHTTPS = set
| ((fromException e)::(Maybe TLS.TLSError))==Just TLS.Error_EOF -> True
#endif
| otherwise -> managerRetryableException defaultManagerSettings e
, managerWrapException = \req ->
, managerWrapException = \req act ->
let wrapper se
| Just (_ :: IOException) <- fromException se = se'
| Just (_ :: TLS.TLSException) <- fromException se = se'
Expand All @@ -110,7 +110,7 @@ mkManagerSettingsContext' set mcontext tls sockHTTP sockHTTPS = set
| otherwise = se
where
se' = toException $ HttpExceptionRequest req $ InternalException se
in handle $ throwIO . wrapper
in handle (throwIO . wrapper) (managerWrapException set req act)
}

-- | Default TLS-enabled manager settings
Expand Down
13 changes: 13 additions & 0 deletions http-client-tls/test/Spec.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}

import Data.IORef (newIORef, readIORef, modifyIORef')
import Test.Hspec
import Network.Connection
import Network.HTTP.Client
Expand Down Expand Up @@ -85,3 +87,14 @@ main = hspec $ do
request <- parseRequest "https://httpbin.org"
response <- httpNoBody request manager
responseStatus response `shouldBe` status200

it "propagates input manager settings" $ do
ref <- newIORef 0
let
tlsManagerSettings' = tlsManagerSettings
{ managerWrapException = \_ act -> modifyIORef' ref (+1) >> act
}
manager <- newTlsManagerWith tlsManagerSettings'
request <- parseRequest "https://httpbin.org"
_ <- httpNoBody request manager
readIORef ref `shouldReturn` 1