diff --git a/httpserver-b64decode.lua b/httpserver-b64decode.lua index a79581e..73c4d58 100755 --- a/httpserver-b64decode.lua +++ b/httpserver-b64decode.lua @@ -37,14 +37,14 @@ end -- logic OR for number values local function lor(x,y) - result = 0 + local result = 0 for p=1,8 do result = result + (((bit(x,p) or bit(y,p)) == true) and uipow(2, (p-1)) or 0) end return result end -- Character decoding table local function toBase64Byte(char) - ascii = string.byte(char, 1) + local ascii = string.byte(char, 1) if ascii >= string.byte('A', 1) and ascii <= string.byte('Z', 1) then return ascii - string.byte('A', 1) elseif ascii >= string.byte('a', 1) and ascii <= string.byte('z', 1) then return ascii - string.byte('a', 1) + 26 elseif ascii >= string.byte('0', 1) and ascii <= string.byte('9', 1) then return ascii + 4 diff --git a/httpserver-basicauth.lua b/httpserver-basicauth.lua index 42109ec..863b34c 100644 --- a/httpserver-basicauth.lua +++ b/httpserver-basicauth.lua @@ -2,7 +2,7 @@ -- Part of nodemcu-httpserver, authenticates a user using http basic auth. -- Author: Sam Dieck -basicAuth = {} +local basicAuth = {} -- Returns true if the user/password match one of the users/passwords in httpserver-conf.lua. -- Returns false otherwise. diff --git a/httpserver-connection.lua b/httpserver-connection.lua index 7026482..52aee69 100644 --- a/httpserver-connection.lua +++ b/httpserver-connection.lua @@ -5,7 +5,7 @@ -- flush() and for closing the connection. -- Author: Philip Gladstone, Marcos Kirsch -BufferedConnection = {} +local BufferedConnection = {} -- parameter is the nodemcu-firmware connection function BufferedConnection:new(connection) diff --git a/httpserver-request.lua b/httpserver-request.lua index 3a7d56b..a186969 100644 --- a/httpserver-request.lua +++ b/httpserver-request.lua @@ -21,7 +21,8 @@ local function uri_decode(input) end local function parseArgs(args) - local r = {}; i=1 + local r = {} + local i = 1 if args == nil or args == "" then return r end for arg in string.gmatch(args, "([^&]+)") do local name, value = string.match(arg, "(.*)=(.*)") @@ -83,7 +84,7 @@ local function parseUri(uri) if uri == nil then return r end if uri == "/" then uri = "/index.html" end - questionMarkPos, b, c, d, e, f = uri:find("?") + local questionMarkPos, b, c, d, e, f = uri:find("?") if questionMarkPos == nil then r.file = uri:sub(1, questionMarkPos) r.args = {} @@ -115,6 +116,7 @@ return function (request) if not e then return nil end local line = request:sub(1, e - 1) local r = {} + local _, i _, i, r.method, r.request = line:find("^([A-Z]+) (.-) HTTP/[1-9]+.[0-9]+$") if not (r.method and r.request) then --print("invalid request: ")