diff options
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index ef9f66aa7..edf2619c0 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -142,9 +142,14 @@ import Text.Pandoc.Data (dataFiles) import Paths_pandoc (getDataFileName) #endif #ifdef HTTP_CLIENT -import Network.HTTP.Client (httpLbs, parseUrl, withManager, +import Network.HTTP.Client (httpLbs, parseUrl, responseBody, responseHeaders, Request(port,host)) +#if MIN_VERSION_http_client(0,4,18) +import Network.HTTP.Client (newManager) +#else +import Network.HTTP.Client (withManager) +#endif import Network.HTTP.Client.Internal (addProxy) import Network.HTTP.Client.TLS (tlsManagerSettings) import System.Environment (getEnv) @@ -905,7 +910,11 @@ openURL u Right pr -> case parseUrl pr of Just r -> addProxy (host r) (port r) req Nothing -> req +#if MIN_VERSION_http_client(0,4,18) + resp <- newManager tlsManagerSettings >>= httpLbs req' +#else resp <- withManager tlsManagerSettings $ httpLbs req' +#endif return (BS.concat $ toChunks $ responseBody resp, UTF8.toString `fmap` lookup hContentType (responseHeaders resp)) #else |