From dc95448d174430b5e0d576841efbde121a3c5308 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sat, 26 Jan 2019 16:55:12 +0100 Subject: [PATCH] =?UTF-8?q?Le=20fichier=20n'avait=20pas=20=C3=A9t=C3=A9=20?= =?UTF-8?q?sauv=C3=A9=20sur=20l'ordi=20;-(?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zyx-framework/web_srv2.lua | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/zyx-framework/web_srv2.lua b/zyx-framework/web_srv2.lua index 16ad45e..d17a880 100644 --- a/zyx-framework/web_srv2.lua +++ b/zyx-framework/web_srv2.lua @@ -1,23 +1,23 @@ -- petit script de serveur WEB Wifi -print("\n web_srv.lua zf190119.1932 \n") +print("\n web_srv.lua zf181018.1610 \n") --dofile("web_get.lua") -dofile("web_html.lua") +--dofile("web_html.lua") srv = net.createServer(net.TCP) srv:listen(80, function(conn) conn:on("receive", function(client, request) _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") - --print("\n\nweb_srv") - --print("method: ",method) - --print("path: ",path) - --print("request: ",request) - --print("vars: ",vars) + print("\n\nweb_srv debug") + print("request: \n---\n"..request.."---") + print("method: ",method) + print("path: ",path) + print("vars: ",vars) if not string.find(request, "/favicon.ico") then - --print("coucou") + print("coucou") if (method == nil) then _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP") end @@ -28,11 +28,14 @@ srv:listen(80, function(conn) print(k..": "..v) end end --- web_get() - html_home() - client:send(buf) - buf=nil + file_html=string.gsub(path, "/", "") + print("file_html: ",file_html) + + conn:send("

ESP8266
Server is working!

\n\n") + end end) conn:on("sent", function(c) c:close() end) end) + + \ No newline at end of file