git.iko.soy/typeable/pandoc
on master help sign in
CPP workaround for deprecation of parseUrl in http-client.
261c3afJohn MacFarlane
src/Text/Pandoc/Shared.hs+14−6
@@ -153,6 +153,9 @@ import Paths_pandoc (getDataFileName)
153import Network.HTTP.Client (httpLbs, parseUrl,
153import Network.HTTP.Client (httpLbs, parseUrl,
154 responseBody, responseHeaders,
154 responseBody, responseHeaders,
155 Request(port,host))
155 Request(port,host))
156+#if MIN_VERSION_http_client(0,4,30)
157+import Network.HTTP.Client (parseRequest)
158+#endif
156#if MIN_VERSION_http_client(0,4,18)
159#if MIN_VERSION_http_client(0,4,18)
157import Network.HTTP.Client (newManager)
160import Network.HTTP.Client (newManager)
158#else
161#else
@@ -946,13 +949,18 @@ openURL u
946 in return $ Right (decodeLenient contents, Just mime)
949 in return $ Right (decodeLenient contents, Just mime)
947#ifdef HTTP_CLIENT
950#ifdef HTTP_CLIENT
948 | otherwise = withSocketsDo $ E.try $ do
951 | otherwise = withSocketsDo $ E.try $ do
952+#if MIN_VERSION_http_client(0,4,30)
953+ let parseReq = parseRequest
954+#else
949− req <- parseUrl u
955+ let parseReq = parseUrl
956+#endif
950 (proxy :: Either E.SomeException String) <- E.try $ getEnv "http_proxy"
957 (proxy :: Either E.SomeException String) <- E.try $ getEnv "http_proxy"
958+ req <- parseReq u
951− let req' = case proxy of
959+ req' <- case proxy of
952− Left _ -> req
960+ Left _ -> return req
953− Right pr -> case parseUrl pr of
961+ Right pr -> (parseReq pr >>= \r ->
954− Just r -> addProxy (host r) (port r) req
962+ return $ addProxy (host r) (port r) req)
955− Nothing -> req
963+ `mplus` return req
956#if MIN_VERSION_http_client(0,4,18)
964#if MIN_VERSION_http_client(0,4,18)
957 resp <- newManager tlsManagerSettings >>= httpLbs req'
965 resp <- newManager tlsManagerSettings >>= httpLbs req'
958#else
966#else