git.iko.soy/typeable/pandoc
on master help sign in
Removed dependency on conduit.
ee8c8daJohn MacFarlane
INSTALL+2−3
@@ -116,9 +116,8 @@ assume that the pandoc source directory is your working directory.
116
116
117 cabal install hsb2hs
117 cabal install hsb2hs
118
118
119− - `http-conduit`: use the `http-conduit` library to fetch external
119+ - `https`: enable support for downloading resources over https
120− resources (default yes -- without this, pandoc cannot make SSL
120+ (using the `http-client` and `http-client-tls` libraries).
121− connections)
122
121
1233. Build:
1223. Build:
124
123
pandoc.cabal+6−5
@@ -196,8 +196,8 @@ Flag embed_data_files
196 Description: Embed data files in binary for relocatable executable.
196 Description: Embed data files in binary for relocatable executable.
197 Default: False
197 Default: False
198
198
199−Flag http-conduit
199+Flag https
200− Description: Enable downloading of resources over https.
200+ Description: Enable support for downloading of resources over https.
201 Default: True
201 Default: True
202
202
203Library
203Library
@@ -239,10 +239,11 @@ Library
239 hslua >= 0.3 && < 0.4,
239 hslua >= 0.3 && < 0.4,
240 binary >= 0.5 && < 0.8
240 binary >= 0.5 && < 0.8
241 Build-Tools: alex, happy
241 Build-Tools: alex, happy
242− if flag(http-conduit)
242+ if flag(https)
243− Build-Depends: http-conduit >= 1.9 && < 2.2,
243+ Build-Depends: http-client >= 0.3.2 && < 0.4,
244+ http-client-tls >= 0.2 && < 0.3,
244 http-types >= 0.8 && < 0.9
245 http-types >= 0.8 && < 0.9
245− cpp-options: -DHTTP_CONDUIT
246+ cpp-options: -DHTTP_CLIENT
246 if flag(embed_data_files)
247 if flag(embed_data_files)
247 cpp-options: -DEMBED_DATA_FILES
248 cpp-options: -DEMBED_DATA_FILES
248 -- Build-Tools: hsb2hs -- not yet recognized by cabal
249 -- Build-Tools: hsb2hs -- not yet recognized by cabal
src/Text/Pandoc/Shared.hs+8−6
@@ -118,11 +118,13 @@ import System.FilePath ( joinPath, splitDirectories )
118#else
118#else
119import Paths_pandoc (getDataFileName)
119import Paths_pandoc (getDataFileName)
120#endif
120#endif
121−#ifdef HTTP_CONDUIT
121+#ifdef HTTP_CLIENT
122import Data.ByteString.Lazy (toChunks)
122import Data.ByteString.Lazy (toChunks)
123−import Network.HTTP.Conduit (httpLbs, parseUrl, withManager,
123+import Network.HTTP.Client (httpLbs, parseUrl, withManager,
124− responseBody, responseHeaders, addProxy,
124+ responseBody, responseHeaders,
125− Request(port,host))
125+ Request(port,host))
126+import Network.HTTP.Client.Internal (addProxy)
127+import Network.HTTP.Client.TLS (tlsManagerSettings)
126import System.Environment (getEnv)
128import System.Environment (getEnv)
127import Network.HTTP.Types.Header ( hContentType)
129import Network.HTTP.Types.Header ( hContentType)
128import Network (withSocketsDo)
130import Network (withSocketsDo)
@@ -665,7 +667,7 @@ openURL u
665 let mime = takeWhile (/=',') $ drop 5 u
667 let mime = takeWhile (/=',') $ drop 5 u
666 contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u
668 contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u
667 in return $ Right (decodeLenient contents, Just mime)
669 in return $ Right (decodeLenient contents, Just mime)
668−#ifdef HTTP_CONDUIT
670+#ifdef HTTP_CLIENT
669 | otherwise = withSocketsDo $ E.try $ do
671 | otherwise = withSocketsDo $ E.try $ do
670 req <- parseUrl u
672 req <- parseUrl u
671 (proxy :: Either E.SomeException String) <- E.try $ getEnv "http_proxy"
673 (proxy :: Either E.SomeException String) <- E.try $ getEnv "http_proxy"
@@ -674,7 +676,7 @@ openURL u
674 Right pr -> case parseUrl pr of
676 Right pr -> case parseUrl pr of
675 Just r -> addProxy (host r) (port r) req
677 Just r -> addProxy (host r) (port r) req
676 Nothing -> req
678 Nothing -> req
677− resp <- withManager $ httpLbs req'
679+ resp <- withManager tlsManagerSettings $ httpLbs req'
678 return (BS.concat $ toChunks $ responseBody resp,
680 return (BS.concat $ toChunks $ responseBody resp,
679 UTF8.toString `fmap` lookup hContentType (responseHeaders resp))
681 UTF8.toString `fmap` lookup hContentType (responseHeaders resp))
680#else
682#else