git.iko.soy/typeable/pandoc
on master help sign in
Added `withSocketsDo` around http conduit code in `openURL`.
142f818John MacFarlane
src/Text/Pandoc/Shared.hs+2−1
@@ -121,6 +121,7 @@ import Data.ByteString.Lazy (toChunks)
121import Network.HTTP.Conduit (httpLbs, parseUrl, withManager,
121import Network.HTTP.Conduit (httpLbs, parseUrl, withManager,
122 responseBody, responseHeaders)
122 responseBody, responseHeaders)
123import Network.HTTP.Types.Header ( hContentType)
123import Network.HTTP.Types.Header ( hContentType)
124+import Network (withSocketsDo)
124#else
125#else
125import Network.URI (parseURI)
126import Network.URI (parseURI)
126import Network.HTTP (findHeader, rspBody,
127import Network.HTTP (findHeader, rspBody,
@@ -644,7 +645,7 @@ openURL u
644 contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u
645 contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u
645 in return $ Right (decodeLenient contents, Just mime)
646 in return $ Right (decodeLenient contents, Just mime)
646#ifdef HTTP_CONDUIT
647#ifdef HTTP_CONDUIT
647− | otherwise = E.try $ do
648+ | otherwise = withSocketsDo $ E.try $ do
648 req <- parseUrl u
649 req <- parseUrl u
649 resp <- withManager $ httpLbs req
650 resp <- withManager $ httpLbs req
650 return (BS.concat $ toChunks $ responseBody resp,
651 return (BS.concat $ toChunks $ responseBody resp,