net.http: Move default SSL/TLS settings into options, allowing them to be overriden in new()
authorKim Alvefur <zash@zash.se>
Fri, 07 Jul 2017 20:31:52 +0200
changeset 8200 55826e29c719
parent 8199 bc2bcfa63b43
child 8201 db82ce3decee
net.http: Move default SSL/TLS settings into options, allowing them to be overriden in new()
net/http.lua
--- a/net/http.lua	Fri Jul 07 20:30:52 2017 +0200
+++ b/net/http.lua	Fri Jul 07 20:31:52 2017 +0200
@@ -196,7 +196,7 @@
 
 	local sslctx = false;
 	if using_https then
-		sslctx = ex and ex.sslctx or { mode = "client", protocol = "sslv23", options = { "no_sslv2", "no_sslv3" } };
+		sslctx = ex and ex.sslctx or self.options and self.options.sslctx;
 	end
 
 	local handler, conn = server.addclient(host, port_number, listener, "*a", sslctx)
@@ -239,7 +239,9 @@
 	return http;
 end
 
-local default_http = new();
+local default_http = new({
+	sslctx = { mode = "client", protocol = "sslv23", options = { "no_sslv2", "no_sslv3" } };
+});
 
 return {
 	request = function (u, ex, callback)