git.iko.soy/typeable/pandoc
on master help sign in
CPP workaround for deprecation of parseUrl in http-client.
commit261c3af05326442ac64ee427861dcba0809cf4a1 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 3 Jul 2016, 21:29 (10 years ago) parent1dbbb2f
1 file changed+14−6
src/Text/Pandoc/Shared.hs+14−6
src/Text/Pandoc/Shared.hs+14−6
@@ -153,6 +153,9 @@ import Paths_pandoc (getDataFileName)
153153import Network.HTTP.Client (httpLbs, parseUrl,
154154 responseBody, responseHeaders,
155155 Request(port,host))
156+#if MIN_VERSION_http_client(0,4,30)
157+import Network.HTTP.Client (parseRequest)
158+#endif
156159#if MIN_VERSION_http_client(0,4,18)
157160import Network.HTTP.Client (newManager)
158161#else
@@ -946,13 +949,18 @@ openURL u
946949 in return $ Right (decodeLenient contents, Just mime)
947950#ifdef HTTP_CLIENT
948951 | otherwise = withSocketsDo $ E.try $ do
949− req <- parseUrl u
952+#if MIN_VERSION_http_client(0,4,30)
953+ let parseReq = parseRequest
954+#else
955+ let parseReq = parseUrl
956+#endif
950957 (proxy :: Either E.SomeException String) <- E.try $ getEnv "http_proxy"
951− let req' = case proxy of
952− Left _ -> req
953− Right pr -> case parseUrl pr of
954− Just r -> addProxy (host r) (port r) req
955− Nothing -> req
958+ req <- parseReq u
959+ req' <- case proxy of
960+ Left _ -> return req
961+ Right pr -> (parseReq pr >>= \r ->
962+ return $ addProxy (host r) (port r) req)
963+ `mplus` return req
956964#if MIN_VERSION_http_client(0,4,18)
957965 resp <- newManager tlsManagerSettings >>= httpLbs req'
958966#else