mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-26 17:35:49 +00:00
Added withSocketsDo around http conduit code in openURL.
This should address #1080, but further testing on Windows is needed before we can close the bug.
This commit is contained in:
@@ -121,6 +121,7 @@ import Data.ByteString.Lazy (toChunks)
|
||||
import Network.HTTP.Conduit (httpLbs, parseUrl, withManager,
|
||||
responseBody, responseHeaders)
|
||||
import Network.HTTP.Types.Header ( hContentType)
|
||||
import Network (withSocketsDo)
|
||||
#else
|
||||
import Network.URI (parseURI)
|
||||
import Network.HTTP (findHeader, rspBody,
|
||||
@@ -644,7 +645,7 @@ openURL u
|
||||
contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u
|
||||
in return $ Right (decodeLenient contents, Just mime)
|
||||
#ifdef HTTP_CONDUIT
|
||||
| otherwise = E.try $ do
|
||||
| otherwise = withSocketsDo $ E.try $ do
|
||||
req <- parseUrl u
|
||||
resp <- withManager $ httpLbs req
|
||||
return (BS.concat $ toChunks $ responseBody resp,
|
||||
|
||||
Reference in New Issue
Block a user