Allow http-client 0.4.30, which is the version in stackage lts.
Previously we required 0.5. Remove CPP conditionals for earlier versions.
This commit is contained in:
parent
4a1ef0b51d
commit
6d13567ac5
2 changed files with 2 additions and 18 deletions
|
@ -301,8 +301,8 @@ Library
|
||||||
else
|
else
|
||||||
Build-Depends: network >= 2 && < 2.6
|
Build-Depends: network >= 2 && < 2.6
|
||||||
if flag(https)
|
if flag(https)
|
||||||
Build-Depends: http-client >= 0.5 && < 0.6,
|
Build-Depends: http-client >= 0.4.30 && < 0.6,
|
||||||
http-client-tls >= 0.3 && < 0.4,
|
http-client-tls >= 0.2.4 && < 0.4,
|
||||||
http-types >= 0.8 && < 0.10
|
http-types >= 0.8 && < 0.10
|
||||||
cpp-options: -DHTTP_CLIENT
|
cpp-options: -DHTTP_CLIENT
|
||||||
if flag(embed_data_files)
|
if flag(embed_data_files)
|
||||||
|
|
|
@ -153,16 +153,8 @@ import Paths_pandoc (getDataFileName)
|
||||||
#ifdef HTTP_CLIENT
|
#ifdef HTTP_CLIENT
|
||||||
import Network.HTTP.Client (httpLbs, responseBody, responseHeaders,
|
import Network.HTTP.Client (httpLbs, responseBody, responseHeaders,
|
||||||
Request(port,host))
|
Request(port,host))
|
||||||
#if MIN_VERSION_http_client(0,4,30)
|
|
||||||
import Network.HTTP.Client (parseRequest)
|
import Network.HTTP.Client (parseRequest)
|
||||||
#else
|
|
||||||
import Network.HTTP.Client (parseUrl)
|
|
||||||
#endif
|
|
||||||
#if MIN_VERSION_http_client(0,4,18)
|
|
||||||
import Network.HTTP.Client (newManager)
|
import Network.HTTP.Client (newManager)
|
||||||
#else
|
|
||||||
import Network.HTTP.Client (withManager)
|
|
||||||
#endif
|
|
||||||
import Network.HTTP.Client.Internal (addProxy)
|
import Network.HTTP.Client.Internal (addProxy)
|
||||||
import Network.HTTP.Client.TLS (tlsManagerSettings)
|
import Network.HTTP.Client.TLS (tlsManagerSettings)
|
||||||
import System.Environment (getEnv)
|
import System.Environment (getEnv)
|
||||||
|
@ -966,11 +958,7 @@ openURL u
|
||||||
in return $ Right (decodeLenient contents, Just mime)
|
in return $ Right (decodeLenient contents, Just mime)
|
||||||
#ifdef HTTP_CLIENT
|
#ifdef HTTP_CLIENT
|
||||||
| otherwise = withSocketsDo $ E.try $ do
|
| otherwise = withSocketsDo $ E.try $ do
|
||||||
#if MIN_VERSION_http_client(0,4,30)
|
|
||||||
let parseReq = parseRequest
|
let parseReq = parseRequest
|
||||||
#else
|
|
||||||
let parseReq = parseUrl
|
|
||||||
#endif
|
|
||||||
(proxy :: Either E.SomeException String) <- E.try $ getEnv "http_proxy"
|
(proxy :: Either E.SomeException String) <- E.try $ getEnv "http_proxy"
|
||||||
req <- parseReq u
|
req <- parseReq u
|
||||||
req' <- case proxy of
|
req' <- case proxy of
|
||||||
|
@ -978,11 +966,7 @@ openURL u
|
||||||
Right pr -> (parseReq pr >>= \r ->
|
Right pr -> (parseReq pr >>= \r ->
|
||||||
return $ addProxy (host r) (port r) req)
|
return $ addProxy (host r) (port r) req)
|
||||||
`mplus` return req
|
`mplus` return req
|
||||||
#if MIN_VERSION_http_client(0,4,18)
|
|
||||||
resp <- newManager tlsManagerSettings >>= httpLbs req'
|
resp <- newManager tlsManagerSettings >>= httpLbs req'
|
||||||
#else
|
|
||||||
resp <- withManager tlsManagerSettings $ httpLbs req'
|
|
||||||
#endif
|
|
||||||
return (BS.concat $ toChunks $ responseBody resp,
|
return (BS.concat $ toChunks $ responseBody resp,
|
||||||
UTF8.toString `fmap` lookup hContentType (responseHeaders resp))
|
UTF8.toString `fmap` lookup hContentType (responseHeaders resp))
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in a new issue