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:
John MacFarlane
2013-12-09 22:35:57 -08:00
parent afa88b4a25
commit 142f81889b
+2 -1
View File
@@ -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,