From 2a3a0458c9dae98b7806991998678a6ead09fa42 Mon Sep 17 00:00:00 2001 From: Bob Wen Date: Fri, 29 Jan 2021 14:10:34 +0800 Subject: [PATCH] add option insecure Allow insecure server connections when using SSL --- README.md | 3 +++ index.coffee | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 659c7bf..a5308ff 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ htpdate -s www.pool.ntp.org -i, --interval The minimum milliseconds between requests Default: 500 + -k, --insecure Allow insecure server connections when using SSL + Default: false + -m, --method HTTP method Default: 'HEAD' diff --git a/index.coffee b/index.coffee index e7aee86..223b726 100644 --- a/index.coffee +++ b/index.coffee @@ -53,6 +53,12 @@ argv = require('./argv') { default: 6000 type: 'number' } + insecure: { + describe: 'Allow insecure server connections when using SSL' + alias: 'k' + default: false + type: 'boolean' + } command: { describe: 'Command to adjust system time, in https://day.js.org/ display format' alias: 'C' @@ -84,6 +90,9 @@ req_opt = { headers: { 'user-agent': argv['user-agent'] } + https: { + rejectUnauthorized: not argv.insecure + } }