diff --git a/Makefile b/Makefile index bffc4307..f1daa3a2 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,13 @@ LUA_INC ?= 3rd/lua $(LUA_STATICLIB) : cd 3rd/lua && $(MAKE) CC='$(CC) -std=gnu99' $(PLAT) -# jemalloc +# https : turn on TLS_MODULE to add https support + +# TLS_MODULE=ltls +TLS_LIB= +TLS_INC= + +# jemalloc JEMALLOC_STATICLIB := 3rd/jemalloc/lib/libjemalloc_pic.a JEMALLOC_INC := 3rd/jemalloc/include/jemalloc @@ -47,7 +53,7 @@ update3rd : CSERVICE = snlua logger gate harbor LUA_CLIB = skynet \ client \ - bson md5 sproto lpeg ltls + bson md5 sproto lpeg $(TLS_MODULE) LUA_CLIB_SKYNET = \ lua-skynet.c lua-seri.c \ @@ -107,7 +113,7 @@ $(LUA_CLIB_PATH)/sproto.so : lualib-src/sproto/sproto.c lualib-src/sproto/lsprot $(CC) $(CFLAGS) $(SHARED) -Ilualib-src/sproto $^ -o $@ $(LUA_CLIB_PATH)/ltls.so : lualib-src/ltls.c | $(LUA_CLIB_PATH) - $(CC) $(CFLAGS) $(SHARED) -Iskynet-src -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include $^ -o $@ -lssl + $(CC) $(CFLAGS) $(SHARED) -Iskynet-src $(TLS_LIB) $(TLS_INC) $^ -o $@ -lssl $(LUA_CLIB_PATH)/lpeg.so : 3rd/lpeg/lpcap.c 3rd/lpeg/lpcode.c 3rd/lpeg/lpprint.c 3rd/lpeg/lptree.c 3rd/lpeg/lpvm.c | $(LUA_CLIB_PATH) $(CC) $(CFLAGS) $(SHARED) -I3rd/lpeg $^ -o $@ diff --git a/lualib-src/ltls.c b/lualib-src/ltls.c index 7494e64a..edf74f41 100644 --- a/lualib-src/ltls.c +++ b/lualib-src/ltls.c @@ -394,7 +394,6 @@ void __attribute__((constructor)) ltls_init(void) { void __attribute__((destructor)) ltls_destory(void) { if(TLS_IS_INIT) { - ERR_remove_state(0); ENGINE_cleanup(); CONF_modules_unload(1); ERR_free_strings(); diff --git a/test/testhttp.lua b/test/testhttp.lua index e4a4b45f..f8019cad 100644 --- a/test/testhttp.lua +++ b/test/testhttp.lua @@ -29,8 +29,12 @@ end local function main() dns.server() http_test("http") - print("---------") - http_test("https") + + if not pcall(require,"ltls") then + print "No ltls module, https is not supported" + else + http_test("https") + end end skynet.start(function()