aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App
diff options
context:
space:
mode:
authorCédric Couralet <cedric.couralet@gmail.com>2020-04-13 23:58:42 +0200
committerGitHub <noreply@github.com>2020-04-13 14:58:42 -0700
commit34775b4128de2801e4d127064f012501ca18d208 (patch)
tree7e88716b3404b5d91839979fe8d882b1dbed7ca5 /src/Text/Pandoc/App
parent21b1358a52d2825dbfa825ae06e7b15d022cc12c (diff)
downloadpandoc-34775b4128de2801e4d127064f012501ca18d208.tar.gz
Add an option to disable certificate validation (#6156)
This commit adds the option `--no-check-certificate`, which disables certificate checking when resources are fetched by HTTP. Co-authored-by: Cécile Chemin <cecile.chemin@insee.fr> Co-authored-by: Juliette Fourcot <juliette.fourcot@insee.fr>
Diffstat (limited to 'src/Text/Pandoc/App')
-rw-r--r--src/Text/Pandoc/App/CommandLineOptions.hs5
-rw-r--r--src/Text/Pandoc/App/Opt.hs5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs
index 164ef17d5..06ee73299 100644
--- a/src/Text/Pandoc/App/CommandLineOptions.hs
+++ b/src/Text/Pandoc/App/CommandLineOptions.hs
@@ -414,6 +414,11 @@ options =
"NAME:VALUE")
""
+ , Option "" ["no-check-certificate"]
+ (NoArg
+ (\opt -> return opt { optNoCheckCertificate = True }))
+ "" -- "Disable certificate validation"
+
, Option "" ["abbreviations"]
(ReqArg
(\arg opt -> return opt { optAbbreviations = Just arg })
diff --git a/src/Text/Pandoc/App/Opt.hs b/src/Text/Pandoc/App/Opt.hs
index d4b36bef3..fb2aeab22 100644
--- a/src/Text/Pandoc/App/Opt.hs
+++ b/src/Text/Pandoc/App/Opt.hs
@@ -140,6 +140,7 @@ data Opt = Opt
, optIncludeInHeader :: [FilePath] -- ^ Files to include in header
, optResourcePath :: [FilePath] -- ^ Path to search for images etc
, optRequestHeaders :: [(Text, Text)] -- ^ Headers for HTTP requests
+ , optNoCheckCertificate :: Bool -- ^ Disable certificate validation
, optEol :: LineEnding -- ^ Style of line-endings to use
, optStripComments :: Bool -- ^ Skip HTML comments
} deriving (Generic, Show)
@@ -390,6 +391,9 @@ doOpt (k',v) = do
"request-headers" ->
parseYAML v >>= \x ->
return (\o -> o{ optRequestHeaders = x })
+ "no-check-certificate" ->
+ parseYAML v >>= \x ->
+ return (\o -> o{ optNoCheckCertificate = x })
"eol" ->
parseYAML v >>= \x -> return (\o -> o{ optEol = x })
"strip-comments" ->
@@ -466,6 +470,7 @@ defaultOpts = Opt
, optIncludeInHeader = []
, optResourcePath = ["."]
, optRequestHeaders = []
+ , optNoCheckCertificate = False
, optEol = Native
, optStripComments = False
}