Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax the upper bounds on the version of crypton-connection #38

Merged
merged 2 commits into from
May 30, 2024
Merged
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
24 changes: 24 additions & 0 deletions test/Network/Connection/CPP.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{-# LANGUAGE CPP #-}

{- |
Module : Network.Connection.CPP
Copyright : (c) 2022 Tim Emiola
Maintainer : Tim Emiola <[email protected]>
SPDX-License-Identifier: BSD3
-}
module Network.Connection.CPP (noCheckSettings) where

import Network.Connection (TLSSettings (..))


#if MIN_VERSION_crypton_connection(0,4,0)
import Data.Default (def)
#endif

#if MIN_VERSION_crypton_connection(0,4,0)
noCheckSettings :: TLSSettings
noCheckSettings = TLSSettingsSimple True False False def
#else
noCheckSettings :: TLSSettings
noCheckSettings = TLSSettingsSimple True False False
#endif
5 changes: 2 additions & 3 deletions test/Test/Fetch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Data.Conduit
import qualified Data.Conduit.Binary as CB
import Data.Int (Int64)
import Data.Maybe (fromMaybe)
import Network.Connection (TLSSettings (..))
import Network.Connection.CPP (noCheckSettings)
import Network.HTTP.Client
( BodyReader
, Request
Expand All @@ -39,14 +39,13 @@ import Network.HTTP.Client
, withResponse
)
import Network.HTTP.Client.TLS (mkManagerSettings)
-- import Network.HTTP.Simple (setRequestManager, withResponse)
import Network.HTTP.Types (hContentLength, statusCode)
import Test.HttpReply


fetch :: Request -> IO HttpReply
fetch req = do
let mSettings = mkManagerSettings (TLSSettingsSimple True False False) Nothing
let mSettings = mkManagerSettings noCheckSettings Nothing
mSettings' = managerSetProxy proxyFromRequest mSettings
m <- newManager mSettings'
withResponse req m getSrc
Expand Down
7 changes: 3 additions & 4 deletions test/Test/NginxGateway.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import Data.List (find)
import Data.Text (Text)
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import Network.Connection (TLSSettings (..))
import Network.Connection.CPP (noCheckSettings)
import qualified Network.HTTP.Client as HC
import qualified Network.HTTP.Client.TLS as HC
import Network.HTTP.Types.Header (hHost)
Expand Down Expand Up @@ -217,9 +217,8 @@ pingHttps handle = toPinged @HC.HttpException Proxy $ do
-- that differs from the connection IP address, that's not supported by
-- http-client-tls
mkBadTlsManager :: IO HC.Manager
mkBadTlsManager = do
let tlsSettings = TLSSettingsSimple True False False
HC.newTlsManagerWith $ HC.mkManagerSettings tlsSettings Nothing
mkBadTlsManager =
HC.newTlsManagerWith $ HC.mkManagerSettings noCheckSettings Nothing


-- | Determine the status from a secure Get to host localhost.
Expand Down
3 changes: 2 additions & 1 deletion wai-middleware-delegate.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ test-suite integration-test
Test.NginxGateway
Test.TestRequests
Test.WithExtras
Network.Connection.CPP

hs-source-dirs: test
build-depends:
Expand All @@ -75,7 +76,7 @@ test-suite integration-test
, case-insensitive
, conduit
, conduit-extra
, crypton-connection >=0.3.1 && < 0.4
, crypton-connection >=0.3.1 && < 0.5
, data-default
, directory >=1.3 && <1.4
, filepath >=1.4 && <1.6
Expand Down
Loading