init.lua: Initialize net.http with an SSL configuration

Thu, 11 Jun 2020 15:27:55 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 11 Jun 2020 15:27:55 +0100
changeset 152
902544037000
parent 151
936364f8efcf
child 153
23b0ddf14e12

init.lua: Initialize net.http with an SSL configuration

init.lua file | annotate | diff | comparison | revisions
--- a/init.lua	Mon Sep 17 14:46:47 2018 +0100
+++ b/init.lua	Thu Jun 11 15:27:55 2020 +0100
@@ -110,7 +110,17 @@
 		io.write("Enter the password for "..config.jid..": ");
 		config.password = io.read("*l");
 	end
-	
+
+	-- Initialize the HTTP client
+	local http = require "net.http";
+	http.default.options.sslctx = {
+		mode = "client";
+		protocol = "sslv23";
+		capath = config.capath or "/etc/ssl/certs";
+		cafile = config.cafile;
+		verify = "peer";
+	};
+
 	-- Create the stream object and bot object
 	local c = verse.new();
 	local b = riddim.new(c, config);

mercurial