Skip to content

Commit

Permalink
Avoid printing duplicate ALPN protocol if server forces one
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Sep 8, 2018
1 parent e1cbd13 commit 7b880da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/tls-alpn.nse
Expand Up @@ -178,6 +178,7 @@ action = function(host, port)
}

local chosen = {}
local unique = {}
while next(alpn_protos) do
-- Send crafted client hello
local status, response = client_hello(host, port, alpn_protos)
Expand All @@ -192,7 +193,10 @@ action = function(host, port)
if i > 1 then
stdnse.verbose1("Server violates RFC: sent additional protocol %s", p)
else
chosen[#chosen+1] = p
if not unique[p] then
chosen[#chosen+1] = p
end
unique[p] = true
if not find_and_remove(alpn_protos, p) then
stdnse.debug1("Chosen ALPN protocol %s was not offered", p)
-- Server is forcing this protocol, no need to continue offering.
Expand Down

0 comments on commit 7b880da

Please sign in to comment.