mirror of
https://github.com/wahyd4/ingress-nginx.git
synced 2026-08-09 05:16:27 +10:00
Add case for when user agent is nil
Add test for nil user agent
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
describe("same_site_compatible_test", function()
|
||||
it("returns true for nil user agent", function()
|
||||
local same_site = require("util.same_site")
|
||||
assert.True(same_site.same_site_none_compatible(nil))
|
||||
end)
|
||||
it("returns false for chrome 4", function()
|
||||
local same_site = require("util.same_site")
|
||||
assert.False(same_site.same_site_none_compatible("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2704.103 Safari/537.36"))
|
||||
|
||||
@@ -13,7 +13,9 @@ local _M = {}
|
||||
-- browsers which will reject SameSite=None cookies.
|
||||
-- reference: https://www.chromium.org/updates/same-site/incompatible-clients
|
||||
function _M.same_site_none_compatible(user_agent)
|
||||
if string.match(user_agent, "Chrome/4") then
|
||||
if not user_agent then
|
||||
return true
|
||||
elseif string.match(user_agent, "Chrome/4") then
|
||||
return false
|
||||
elseif string.match(user_agent, "Chrome/5") then
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user