1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 07:29:01 +00:00

http.lua tests using gzip will fail unless zlib is available.

This commit is contained in:
dmiller
2019-05-24 18:28:49 +00:00
parent bbdac0e8fe
commit 302f5d5bd6

View File

@@ -3159,14 +3159,25 @@ do
decoded = {"identity"}, decoded = {"identity"},
undecoded = {"mystery", "miracle"} undecoded = {"mystery", "miracle"}
}) })
table.insert(content_encoding_tests, if have_zlib then
{ name = "stacked encoding", table.insert(content_encoding_tests,
encoding = "identity, gzip, identity", { name = "stacked encoding",
source = stdnse.fromhex("1f8b0800000000000000f348cdc9c9d75108cf2fca49510400d0c34aec0d000000"), encoding = "identity, gzip, identity",
target = "Hello, World!", source = stdnse.fromhex("1f8b0800000000000000f348cdc9c9d75108cf2fca49510400d0c34aec0d000000"),
decoded = {"identity", "gzip", "identity"}, target = "Hello, World!",
undecoded = {} decoded = {"identity", "gzip", "identity"},
}) undecoded = {}
})
else
table.insert(content_encoding_tests,
{ name = "stacked encoding",
encoding = "identity, gzip, identity",
source = stdnse.fromhex("1f8b0800000000000000f348cdc9c9d75108cf2fca49510400d0c34aec0d000000"),
target = stdnse.fromhex("1f8b0800000000000000f348cdc9c9d75108cf2fca49510400d0c34aec0d000000"),
decoded = {"identity"},
undecoded = {"gzip", "identity"},
})
end
for _, test in ipairs(content_encoding_tests) do for _, test in ipairs(content_encoding_tests) do
local body, dcd, undcd, err, fragment = decode_body(test.source, test.encoding, test.maxlen) local body, dcd, undcd, err, fragment = decode_body(test.source, test.encoding, test.maxlen)
test_suite:add_test(unittest.equal(body, test.target), test.name .. " (body)") test_suite:add_test(unittest.equal(body, test.target), test.name .. " (body)")