git.iko.soy/typeable/pandoc
on master help sign in
Remove https flag.

Supporting two completely different libraries for fetching from URLs makes it difficult to trap errors, because of different error types expected from the libraries. There's no clear reason not to build with these https-capable libraires.

commitd414b2543a1686007e84c54bc711dff969dfb569 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 7 May 2017, 12:49 (9 years ago) parentf8e125f
5 files changed+4−34
pandoc.cabal+4−10 src/Text/Pandoc/Shared.hs−21 stack.full.yaml−1 stack.pkg.yaml−1 stack.yaml−1
pandoc.cabal+4−10
@@ -264,10 +264,6 @@ Flag weigh-pandoc
264264 Description: Build weigh-pandoc to measure memory usage.
265265 Default: False
266266
267−Flag https
268− Description: Enable support for downloading of resources over https.
269− Default: True
270−
271267Flag network-uri
272268 Description: Get Network.URI from the network-uri package
273269 Default: True
@@ -316,7 +312,10 @@ Library
316312 JuicyPixels >= 3.1.6.1 && < 3.3,
317313 Glob >= 0.7 && < 0.8,
318314 cmark >= 0.5 && < 0.6,
319− doctemplates >= 0.1 && < 0.2
315+ doctemplates >= 0.1 && < 0.2,
316+ http-client >= 0.4.30 && < 0.6,
317+ http-client-tls >= 0.2.4 && < 0.4,
318+ http-types >= 0.8 && < 0.10
320319 if os(windows)
321320 Cpp-options: -D_WINDOWS
322321 else
@@ -330,11 +329,6 @@ Library
330329 Build-Depends: network-uri >= 2.6 && < 2.7, network >= 2.6
331330 else
332331 Build-Depends: network >= 2 && < 2.6
333− if flag(https)
334− Build-Depends: http-client >= 0.4.30 && < 0.6,
335− http-client-tls >= 0.2.4 && < 0.4,
336− http-types >= 0.8 && < 0.10
337− cpp-options: -DHTTP_CLIENT
338332 if flag(embed_data_files)
339333 cpp-options: -DEMBED_DATA_FILES
340334 build-depends: file-embed >= 0.0 && < 0.1
src/Text/Pandoc/Shared.hs−21
@@ -140,7 +140,6 @@ import Text.Pandoc.Data (dataFiles)
140140#else
141141import Paths_pandoc (getDataFileName)
142142#endif
143−#ifdef HTTP_CLIENT
144143import Network.HTTP.Client (httpLbs, responseBody, responseHeaders,
145144 Request(port,host,requestHeaders))
146145import Network.HTTP.Client (parseRequest)
@@ -150,12 +149,6 @@ import Network.HTTP.Client.TLS (tlsManagerSettings)
150149import System.Environment (getEnv)
151150import Network.HTTP.Types.Header ( hContentType, hUserAgent)
152151import Network (withSocketsDo)
153−#else
154−import Network.URI (parseURI)
155−import Network.HTTP (findHeader, rspBody,
156− RequestMethod(..), HeaderName(..), mkRequest)
157−import Network.Browser (browse, setAllowRedirects, setOutHandler, request)
158−#endif
159152
160153-- | Version number of pandoc library.
161154pandocVersion :: String
@@ -715,7 +708,6 @@ openURL u
715708 let mime = takeWhile (/=',') u''
716709 contents = B8.pack $ unEscapeString $ drop 1 $ dropWhile (/=',') u''
717710 in return (decodeLenient contents, Just mime)
718−#ifdef HTTP_CLIENT
719711 | otherwise = withSocketsDo $ do
720712 let parseReq = parseRequest
721713 (proxy :: Either IOError String) <-
@@ -738,19 +730,6 @@ openURL u
738730 resp <- newManager tlsManagerSettings >>= httpLbs req''
739731 return (BS.concat $ toChunks $ responseBody resp,
740732 UTF8.toString `fmap` lookup hContentType (responseHeaders resp))
741−#else
742− | otherwise = getBodyAndMimeType `fmap` browse
743− (do liftIO $ UTF8.hPutStrLn stderr $ "Fetching " ++ u ++ "..."
744− setOutHandler $ const (return ())
745− setAllowRedirects True
746− request (getRequest' u'))
747− where getBodyAndMimeType (_, r) = (rspBody r, findHeader HdrContentType r)
748− getRequest' uriString = case parseURI uriString of
749− Nothing -> error ("Not a valid URL: " ++
750− uriString)
751− Just v -> mkRequest GET v
752− u' = escapeURIString (/= '|') u -- pipes are rejected by Network.URI
753−#endif
754733
755734--
756735-- Error reporting
stack.full.yaml−1
@@ -3,7 +3,6 @@
33flags:
44 pandoc:
55 trypandoc: false
6− https: true
76 embed_data_files: false
87 old-locale: false
98 network-uri: true
stack.pkg.yaml−1
@@ -1,7 +1,6 @@
11flags:
22 pandoc:
33 trypandoc: false
4− https: true
54 embed_data_files: true
65 old-locale: false
76 network-uri: true
stack.yaml−1
@@ -1,7 +1,6 @@
11flags:
22 pandoc:
33 trypandoc: false
4− https: true
54 embed_data_files: false
65 old-locale: false
76 network-uri: true