comparison http/src/luan/modules/http/Server.luan @ 753:5e3970ccd86a

improve password handling
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 15 Jul 2016 17:35:50 -0600
parents 2c41f2aec92f
children 3f461f85243d
comparison
equal deleted inserted replaced
752:ea5f3a254b76 753:5e3970ccd86a
30 local NotFound = require "java:luan.modules.http.NotFound" 30 local NotFound = require "java:luan.modules.http.NotFound"
31 31
32 local M = {} 32 local M = {}
33 33
34 M.port = 8080 34 M.port = 8080
35
36 M.private_password = "password"
37 35
38 M.welcome_file = "index.html" 36 M.welcome_file = "index.html"
39 37
40 38
41 M.authentication_handler = AuthenticationHandler.new("/private/") 39 M.authentication_handler = AuthenticationHandler.new("/private/")
84 dir = gsub(dir,"/$","") -- remove trailing '/' if any 82 dir = gsub(dir,"/$","") -- remove trailing '/' if any
85 Http.dir = dir 83 Http.dir = dir
86 function Io.schemes.site(path) 84 function Io.schemes.site(path)
87 return Io.uri( dir..path ) 85 return Io.uri( dir..path )
88 end 86 end
89 M.authentication_handler.setPassword(M.private_password) 87 M.authentication_handler.setPassword(Io.password)
90 local base = dir 88 local base = dir
91 if matches(base,"^classpath:") then 89 if matches(base,"^classpath:") then
92 base = dir.."#"..M.welcome_file.."#"..M.welcome_file..".luan" 90 base = dir.."#"..M.welcome_file.."#"..M.welcome_file..".luan"
93 end 91 end
94 M.resource_handler.setResourceBase(Io.uri(base).to_string()) 92 M.resource_handler.setResourceBase(Io.uri(base).to_string())