Mercurial Hosting > luan
changeset 1751:357daf580951
LuanDomainHandler domain check
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 24 Jan 2023 16:30:29 -0700 |
parents | c7b3c327248a |
children | b4fa42c1e999 |
files | src/luan/modules/http/LuanDomainHandler.java |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/modules/http/LuanDomainHandler.java Tue Jan 10 22:42:47 2023 -0700 +++ b/src/luan/modules/http/LuanDomainHandler.java Tue Jan 24 16:30:29 2023 -0700 @@ -24,13 +24,17 @@ @Override public Handler newHandler(String domain) { Luan luan = newLuan(domain); - return new LuanHandler(luan,domain); + return luan==null ? null : new LuanHandler(luan,domain); } protected Luan newLuan(final String domain) { try { Luan luan = new Luan(); - init.call(luan); + Object rtn = init.call(luan,domain); + if( !(rtn instanceof Boolean) ) + throw new LuanException("init must return boolean"); + if( !(Boolean)rtn ) + return null; LuanFunction reset_luan = new LuanFunction() { @Override public Object call(Luan luan,Object[] args) { domainHandler.removeHandler(domain);