hugo.soucy.cc

The personnal website source code of Hugo Soucy. Creates from an homebrewed static website generator (Ferron).
Log | Files | Refs

commit b1f830400f69c717b8df9d6694639ec09cf5d011
parent 558b0b99d0f7616739c7044924fdc09c91787bf7
Author: Hugo Soucy <hugo.soucy@equisoft.com>
Date:   Tue,  1 Oct 2019 22:30:18 -0400

Make some tests in the httpd plugin

Diffstat:
Mplugins/httpd/init.lua | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/plugins/httpd/init.lua b/plugins/httpd/init.lua @@ -1,5 +1,7 @@ -- httpd.lua +--package.path = package.path .. ';../../?.lua' + local httpd = {} local httpdmeta = { __call = function(self, key, vars) @@ -16,8 +18,12 @@ function httpd.init(sitedata) }) return server:start(function(request, response) - print('= Request: ' .. inspect(request.firstLine)) - print('= Response: ' .. inspect(response.headFirstLine)) + if request._path == '' or '/' then + print("response path ", request._path) + + -- response:statusCode(301) + -- response:addHeader('Location', './' .. request._path .. 'index.html') + end end) end