refactor
authorJoey Hess <joeyh@joeyh.name>
Thu, 15 Oct 2015 14:34:19 +0000 (10:34 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 15 Oct 2015 14:34:19 +0000 (10:34 -0400)
Utility/Url.hs

index 19568fda8195f96b2c83e47daeb594b9be2e916f..c53ed5c6a02122d9b6052691150a6787b0114d2c 100644 (file)
@@ -12,6 +12,7 @@
 
 module Utility.Url (
        closeManager,
+       managerSettings,
        URLString,
        UserAgent,
        UrlOptions,
@@ -48,6 +49,13 @@ closeManager :: Manager -> IO ()
 closeManager _ = return ()
 #endif
 
+managerSettings :: ManagerSettings
+#if MIN_VERSION_http_conduit(2,1,7)
+managerSettings = tlsManagerSettings
+#else
+managerSettings = conduitManagerSettings
+#endif
+
 type URLString = String
 
 type Headers = [String]
@@ -176,12 +184,7 @@ getUrlInfo url uo = case parseURIRelaxed url of
                filter (\p -> fst p == h) . responseHeaders
 
        existsconduit req = do
-               mgr <- newManager
-#if MIN_VERSION_http_conduit(2,1,7)
-                       tlsManagerSettings
-#else
-                       conduitManagerSettings
-#endif
+               mgr <- newManager managerSettings
                let req' = headRequest (applyRequest uo req)
                ret <- runResourceT $ do
                        resp <- http req' mgr