diff --git a/nselib/http.lua b/nselib/http.lua index 914a6eb21..a18d6b40b 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -1415,16 +1415,16 @@ function parse_date(s) end -- See RFC 2617, section 1.2. This function returns a table with keys "scheme" --- and "namevals". +-- and "params". local read_auth_challenge = function(s, pos) - local _, pos, scheme, namevals + local _, pos, scheme, params pos, scheme = read_token(s, pos) if not scheme then return nil end - namevals = {} + params = {} pos = skip_space(s, pos) while pos < string.len(s) do local name, val @@ -1436,10 +1436,10 @@ local read_auth_challenge = function(s, pos) end pos = pos + 1 pos, val = read_token_or_quoted_string(s, pos) - if namevals[name] then + if params[name] then return nil end - namevals[name] = val + params[name] = val pos = skip_space(s, pos) if string.sub(s, pos, pos) == "," then pos = skip_space(s, pos + 1) @@ -1449,14 +1449,14 @@ local read_auth_challenge = function(s, pos) end end - return pos, { scheme = scheme, namevals = namevals } + return pos, { scheme = scheme, param = param } end --- -- Parses the WWW-Authenticate header as described in RFC 2616, section 14.47 -- and RFC 2617, section 1.2. The return value is an array of challenges. Each -- challenge is a table with the keys scheme and --- namevals. +-- params. -- @param s The header value text. -- @return An array of challenges, or nil on error. parse_www_authenticate = function(s) diff --git a/scripts/http-auth.nse b/scripts/http-auth.nse index 87f35d077..122b90f95 100644 --- a/scripts/http-auth.nse +++ b/scripts/http-auth.nse @@ -64,7 +64,7 @@ action = function(host, port) basic_challenge = challenge end local line = challenge.scheme - for name, value in pairs(challenge.namevals) do + for name, value in pairs(challenge.params) do line = line .. string.format(" %s=%s", name, value) end result[#result + 1] = line