changeset 1238:3d29033de2bf

changes for https
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 11 Jun 2018 22:03:09 -0600
parents 275d1b52dbce
children 2612e4307987
files src/luan/host/Init.luan src/luan/host/WebHandler.java
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
diff -r 275d1b52dbce -r 3d29033de2bf src/luan/host/Init.luan
--- a/src/luan/host/Init.luan	Mon Jun 11 18:22:51 2018 -0600
+++ b/src/luan/host/Init.luan	Mon Jun 11 22:03:09 2018 -0600
@@ -1,5 +1,6 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
+local do_file = Luan.do_file or error()
 local String = require "luan:String.luan"
 local gsub = String.gsub or error()
 
@@ -62,7 +63,7 @@
 local Hosting = require "luan:host/Hosting.luan"
 local Mail = require "luan:mail/Mail.luan"
 
-Init.password = Luan.do_file(dir.."/info.luan").password or error()
+Init.password = do_file(dir.."/info.luan").password or error()
 
 Http.dir = "file:"..dir.."/site"
 
@@ -84,4 +85,8 @@
 }.send
 
 
+-- callback to luanhost code
+do_file "file:init.luan"
+
+
 return Init
diff -r 275d1b52dbce -r 3d29033de2bf src/luan/host/WebHandler.java
--- a/src/luan/host/WebHandler.java	Mon Jun 11 18:22:51 2018 -0600
+++ b/src/luan/host/WebHandler.java	Mon Jun 11 22:03:09 2018 -0600
@@ -214,7 +214,7 @@
 
 	private static final JavaLuan.Security javaSecurity = new JavaLuan.Security() {
 		public void check(LuanState luan,String name) throws LuanException {
-			if( !name.startsWith("luan:") )
+			if( !(name.startsWith("luan:") || name.matches("^file:[^/]+$")) )
 				throw new LuanException("Security violation - only luan:* modules can load Java");
 			if( name.equals("luan:logging/Logging") )
 				throw new LuanException("Security violation - cannot reload Logging");