Skip to content

Commit 43710ff

Browse files
author
Johnny Tordgeman
authored
Merge pull request #166 from PerimeterX/dev
Version 5.3.2
2 parents d1bacc3 + f243a76 commit 43710ff

File tree

5 files changed

+36
-14
lines changed

5 files changed

+36
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [5.3.2] - 2018-11-13
9+
### Fixed
10+
- Cookie name extractor ability to handle multiple Cookie headers
11+
812
## [5.3.1] - 2018-11-07
913
### Fixed
1014
- Wrong value in Json response's vid property

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# [PerimeterX](http://www.perimeterx.com) NGINX Lua Plugin
66

7-
> Latest stable version: [v5.3.0](https://luarocks.org/modules/bendpx/perimeterx-nginx-plugin/5.3-1)
7+
> Latest stable version: [v5.3.2](https://luarocks.org/modules/bendpx/perimeterx-nginx-plugin/5.3-2)
88
99

1010
## [Introduction](#introduction)

lib/px/utils/pxcommonutils.lua

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,30 @@ function _M.decode_uri_component(str)
104104
return (str:gsub("%%(%x%x)", hex_to_char))
105105
end
106106

107-
function _M.extract_cookie_names(str)
108-
local t
109-
if str ~= nil then
110-
t = {}
111-
local index = 1;
112-
for token in string.gmatch(str, ("([^;]+)")) do
113-
local key_value = trim(token)
114-
for key, value in string.gmatch(key_value, "(%w+)=(%w+)") do
115-
t[index] = key
116-
index = index + 1
107+
function _M.extract_cookie_names(cookies)
108+
local t = {}
109+
local cookies_data = ""
110+
if cookies ~= nil then
111+
if type(cookies) == 'table' then
112+
for k, v in pairs(cookies) do
113+
local trimmed = trim(v)
114+
if not ends_with(trimmed, ";") then
115+
trimmed = trimmed .. ";"
116+
end
117+
cookies_data = cookies_data .. trimmed
118+
end
119+
elseif type(cookies) == 'string' then
120+
cookies_data = cookies
121+
end
122+
123+
if (cookies_data ~= "") then
124+
local index = 1;
125+
for token in string.gmatch(cookies_data, ("([^;]+)")) do
126+
local key_value = trim(token)
127+
for key, value in string.gmatch(key_value, "(%w+)=(%w+)") do
128+
t[index] = key
129+
index = index + 1
130+
end
117131
end
118132
end
119133
end
@@ -124,4 +138,8 @@ function trim(s)
124138
return (s:gsub("^%s*(.-)%s*$", "%1"))
125139
end
126140

141+
function ends_with(str, ending)
142+
return ending == "" or str:sub(-#ending) == ending
143+
end
144+
127145
return _M

lib/px/utils/pxconstants.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
----------------------------------------------
44

55
local _M = {
6-
MODULE_VERSION = "NGINX Module v5.3.1",
6+
MODULE_VERSION = "NGINX Module v5.3.2",
77
RISK_PATH = "/api/v3/risk",
88
CAPTCHA_PATH = "/api/v2/risk/captcha",
99
ACTIVITIES_PATH = "/api/v1/collector/s2s",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package = "perimeterx-nginx-plugin"
2-
version = "5.3-1"
2+
version = "5.3-2"
33
source = {
44
url = "git://github.com/PerimeterX/perimeterx-nginx-plugin.git",
5-
tag = "v5.3.1",
5+
tag = "v5.3.2",
66
}
77
description = {
88
summary = "PerimeterX NGINX Lua Middleware.",

0 commit comments

Comments
 (0)