Mercurial Hosting > luan
changeset 204:cee6581b6f56
minor
git-svn-id: https://luan-java.googlecode.com/svn/trunk@205 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Sun, 06 Jul 2014 04:48:23 +0000 |
parents | 99eef1d0e706 |
children | 3918f92de5fe |
files | core/src/luan/modules/IoLuan.java web/src/luan/modules/web/Web_server.luan |
diffstat | 2 files changed, 5 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/core/src/luan/modules/IoLuan.java Sun Jul 06 03:54:08 2014 +0000 +++ b/core/src/luan/modules/IoLuan.java Sun Jul 06 04:48:23 2014 +0000 @@ -509,23 +509,13 @@ private static String SECURITY_KEY = "Io.Security"; private static void check(LuanState luan,String name) throws LuanException { - @SuppressWarnings("unchecked") - List<Security> list = (List<Security>)luan.registry().get(SECURITY_KEY); - if( list==null ) - return; - for( Security s : list ) { + Security s = (Security)luan.registry().get(SECURITY_KEY); + if( s!=null ) s.check(luan,name); - } } - public static void addSecurity(LuanState luan,Security s) { - @SuppressWarnings("unchecked") - List<Security> list = (List<Security>)luan.registry().get(SECURITY_KEY); - if( list==null ) { - list = new ArrayList<Security>(); - luan.registry().put(SECURITY_KEY,list); - } - list.add(s); + public static void setSecurity(LuanState luan,Security s) { + luan.registry().put(SECURITY_KEY,s); } public static class DirSecurity implements Security {
--- a/web/src/luan/modules/web/Web_server.luan Sun Jul 06 03:54:08 2014 +0000 +++ b/web/src/luan/modules/web/Web_server.luan Sun Jul 06 04:48:23 2014 +0000 @@ -64,6 +64,7 @@ function serve(dir) dir = dir.gsub("/$","") -- remove trailing '/' if any + Http.dir = dir Package.path = dir.."?.luan;java:luan/modules/?.luan" authentication_handler.setPassword(private_password) resource_handler.setResourceBase(Io.File(dir).to_string())