Complètement refactorisé la partie lecture du fichier html de mon pico framework car elle rentrait en conflit avec d'autres scripts qui utilisaient la flash

Quasiment terminé la petite démo de la correction d'un capteur non linéaire, la démon fonctionne dans la page 3 html !
This commit is contained in:
Christian Zufferey
2019-04-22 11:40:17 +02:00
parent 155b9ae52b
commit 97c4c0fef1
8 changed files with 79 additions and 67 deletions

View File

@@ -1,7 +1,6 @@
-- petit script de serveur WEB avec Active Server Page ZYX
-- pour l'instant la partie ASP n'est que mono tâche !
print("\n web_srv2.lua zf190314.1507 \n")
print("\n web_srv2.lua zf190422.1135 \n")
ztemp=12
@@ -17,9 +16,10 @@ function send_file(zclient, zfilename)
zclient:send("Content-Type: text/html\n\n")
zzclient = zclient -- export le port sur l'environnement global !
if zfilename == "" then zfilename = "z_index.html" end
if file.open(zfilename, "r") then
file_web = file.open(zfilename, "r")
if file_web then
repeat
local line = file.read('\n')
local line = file_web:read('\n')
if line then
if string.find(line, "<%%") then
-- print("start lua...")
@@ -37,8 +37,8 @@ function send_file(zclient, zfilename)
zclient:send(line) -- envoie le code HTML
end
end
until not line
file.close()
until not line
file_web:close() file_web = nil
else
zclient:send("<html><h1>"..zfilename.." not found - 404 error</h1><a href='/'>Home</a><br></html>")
end