summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-07-27 12:09:46 +0000
committerSteven Barth <steven@midlink.org>2009-07-27 12:09:46 +0000
commit17e7f67a7c0bbfa26154005a49faf74b3573ff5d (patch)
tree4a33f661b689c70d0935cb036685adfd8b76e5a1 /libs
parentce98fdd80f549ab72c25c5cd799d4946433e4e2c (diff)
Add native support for homepages
Diffstat (limited to 'libs')
-rw-r--r--libs/lucid-http/luasrc/lucid/http/LuciWebPublisher.lua7
-rw-r--r--libs/lucid-http/luasrc/lucid/http/server.lua4
-rw-r--r--libs/lucid/hostfiles/etc/config/lucid2
-rw-r--r--libs/lucid/root/etc/config/lucid1
4 files changed, 13 insertions, 1 deletions
diff --git a/libs/lucid-http/luasrc/lucid/http/LuciWebPublisher.lua b/libs/lucid-http/luasrc/lucid/http/LuciWebPublisher.lua
index f72b94f41a..92dd7e2cbe 100644
--- a/libs/lucid-http/luasrc/lucid/http/LuciWebPublisher.lua
+++ b/libs/lucid-http/luasrc/lucid/http/LuciWebPublisher.lua
@@ -56,11 +56,18 @@ function factory(server, config)
end
end
+ local mypath
if type(config.virtual) == "table" then
for _, v in ipairs(config.virtual) do
+ mypath = mypath or v
vhost:set_handler(v, handler)
end
else
+ mypath = config.virtual
vhost:set_handler(config.virtual, handler)
end
+
+ if config.home then
+ vhost.default = mypath
+ end
end \ No newline at end of file
diff --git a/libs/lucid-http/luasrc/lucid/http/server.lua b/libs/lucid-http/luasrc/lucid/http/server.lua
index cb10813b9e..eb6f6f54f8 100644
--- a/libs/lucid-http/luasrc/lucid/http/server.lua
+++ b/libs/lucid-http/luasrc/lucid/http/server.lua
@@ -198,6 +198,10 @@ function VHost.process(self, request, ...)
-- Call URI part
request.env.PATH_INFO = uri
+ if self.default and uri == "/" then
+ return 302, {Location = self.default}
+ end
+
for k, h in pairs(self.handlers) do
if #k > hlen then
if uri == k or (uri:sub(1, #k) == k and uri:byte(#k+1) == sc) then
diff --git a/libs/lucid/hostfiles/etc/config/lucid b/libs/lucid/hostfiles/etc/config/lucid
index 934faa10ed..22b7efad9c 100644
--- a/libs/lucid/hostfiles/etc/config/lucid
+++ b/libs/lucid/hostfiles/etc/config/lucid
@@ -19,6 +19,7 @@ config LuciWebPublisher luciweb
option physical ''
list virtual /luci
option domain ''
+ option home 1
list exec ':lo'
list exec ':br-lan'
list exec 'root'
@@ -71,4 +72,3 @@ config 'Redirector' 'splashredir'
option 'virtual' '/'
option 'physical' ':80/luci/splash'
- \ No newline at end of file
diff --git a/libs/lucid/root/etc/config/lucid b/libs/lucid/root/etc/config/lucid
index c5a3f3d8ee..07c32c16c8 100644
--- a/libs/lucid/root/etc/config/lucid
+++ b/libs/lucid/root/etc/config/lucid
@@ -15,6 +15,7 @@ config DirectoryPublisher webroot
config LuciWebPublisher luciweb
option name 'LuCI Webapplication'
option physical ''
+ option home 1
list virtual /luci
list virtual /cgi-bin/luci
option domain ''