From accf960f35562e7ce9268d02782da6ef1853b091 Mon Sep 17 00:00:00 2001 From: Stanislav Saltanov Date: Thu, 16 May 2019 17:27:06 +0500 Subject: [PATCH 1/6] FIX cookie uri_escape was unnecessary --- http/server.lua | 8 ++++++-- rockspecs/http-1.0.1-1.rockspec | 9 +++++---- rockspecs/http-1.0.2-1.rockspec | 7 ++++--- rockspecs/http-scm-1.rockspec | 7 ++++--- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/http/server.lua b/http/server.lua index d592deb..344989c 100644 --- a/http/server.lua +++ b/http/server.lua @@ -279,7 +279,7 @@ local function setcookie(resp, cookie) local str = sprintf('%s=%s', name, uri_escape(value)) if cookie.path ~= nil then - str = sprintf('%s;path=%s', str, uri_escape(cookie.path)) + str = sprintf('%s;path=%s', str, cookie.path) end if cookie.domain ~= nil then str = sprintf('%s;domain=%s', str, cookie.domain) @@ -635,7 +635,11 @@ end local function handler(self, request) if self.hooks.before_dispatch ~= nil then - self.hooks.before_dispatch(self, request) + local resp = self.hooks.before_dispatch(self, request) + + if resp then + return resp + end end local format = 'html' diff --git a/rockspecs/http-1.0.1-1.rockspec b/rockspecs/http-1.0.1-1.rockspec index e328c41..9e2b15f 100644 --- a/rockspecs/http-1.0.1-1.rockspec +++ b/rockspecs/http-1.0.1-1.rockspec @@ -1,12 +1,13 @@ package = 'http' version = '1.0.1-1' source = { - url = 'git://github.com/tarantool/http.git', - tag = '1.0.1', + url = 'git://github.com/get-net/http.git', + branch = 'cookie_fix', + tag = 'cookie_fix', } description = { - summary = "HTTP server for Tarantool", - homepage = 'https://github.com/tarantool/http/', + summary = 'HTTP server for Tarantool', + homepage = 'https://github.com/get-net/http/', license = 'BSD', } dependencies = { diff --git a/rockspecs/http-1.0.2-1.rockspec b/rockspecs/http-1.0.2-1.rockspec index 31b5ed7..349b51e 100644 --- a/rockspecs/http-1.0.2-1.rockspec +++ b/rockspecs/http-1.0.2-1.rockspec @@ -1,12 +1,13 @@ package = 'http' version = '1.0.2-1' source = { - url = 'git://github.com/tarantool/http.git', - tag = '1.0.2', + url = 'git://github.com/get-net/http.git', + branch = 'cookie_fix' + tag = 'cookie_fix', } description = { summary = "HTTP server for Tarantool", - homepage = 'https://github.com/tarantool/http/', + homepage = 'https://github.com/get-net/http/', license = 'BSD', } dependencies = { diff --git a/rockspecs/http-scm-1.rockspec b/rockspecs/http-scm-1.rockspec index 3713e0a..4874309 100644 --- a/rockspecs/http-scm-1.rockspec +++ b/rockspecs/http-scm-1.rockspec @@ -1,12 +1,13 @@ package = 'http' version = 'scm-1' source = { - url = 'git://github.com/tarantool/http.git', - branch = 'master', + url = 'git://github.com/get-net/http.git', + tag = 'cookie_fix', + branch = 'cookie_fix', } description = { summary = "HTTP server for Tarantool", - homepage = 'https://github.com/tarantool/http/', + homepage = 'https://github.com/get-net/http/', license = 'BSD', } dependencies = { From 11a06307a0780b33434f004547c5479610bc6703 Mon Sep 17 00:00:00 2001 From: Admira1Awesome <35958036+Admira1Awesome@users.noreply.github.com> Date: Thu, 16 May 2019 17:44:28 +0500 Subject: [PATCH 2/6] Update http-1.0.2-1.rockspec --- rockspecs/http-1.0.2-1.rockspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rockspecs/http-1.0.2-1.rockspec b/rockspecs/http-1.0.2-1.rockspec index 349b51e..a5c1c7a 100644 --- a/rockspecs/http-1.0.2-1.rockspec +++ b/rockspecs/http-1.0.2-1.rockspec @@ -2,7 +2,7 @@ package = 'http' version = '1.0.2-1' source = { url = 'git://github.com/get-net/http.git', - branch = 'cookie_fix' + branch = 'cookie_fix', tag = 'cookie_fix', } description = { From f03a3ecfc9be2d80cd99339dc4ce558d409cd06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A8=D0=B8=D0=BF=D0=B8=D1=86=D1=8B=D0=BD=20=D0=90=D0=BD?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D0=BB=D0=B8=D0=B9?= Date: Fri, 17 May 2019 12:34:19 +0500 Subject: [PATCH 3/6] Revert changes from our fork --- http/server.lua | 6 +----- rockspecs/http-1.0.1-1.rockspec | 5 ++--- rockspecs/http-1.0.2-1.rockspec | 5 ++--- rockspecs/http-scm-1.rockspec | 5 ++--- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/http/server.lua b/http/server.lua index 344989c..4bbb106 100644 --- a/http/server.lua +++ b/http/server.lua @@ -635,11 +635,7 @@ end local function handler(self, request) if self.hooks.before_dispatch ~= nil then - local resp = self.hooks.before_dispatch(self, request) - - if resp then - return resp - end + self.hooks.before_dispatch(self, request) end local format = 'html' diff --git a/rockspecs/http-1.0.1-1.rockspec b/rockspecs/http-1.0.1-1.rockspec index 9e2b15f..947284f 100644 --- a/rockspecs/http-1.0.1-1.rockspec +++ b/rockspecs/http-1.0.1-1.rockspec @@ -1,9 +1,8 @@ package = 'http' version = '1.0.1-1' source = { - url = 'git://github.com/get-net/http.git', - branch = 'cookie_fix', - tag = 'cookie_fix', + url = 'git://github.com/tarantool/http.git', + tag = '1.0.1', } description = { summary = 'HTTP server for Tarantool', diff --git a/rockspecs/http-1.0.2-1.rockspec b/rockspecs/http-1.0.2-1.rockspec index a5c1c7a..5e82c46 100644 --- a/rockspecs/http-1.0.2-1.rockspec +++ b/rockspecs/http-1.0.2-1.rockspec @@ -1,9 +1,8 @@ package = 'http' version = '1.0.2-1' source = { - url = 'git://github.com/get-net/http.git', - branch = 'cookie_fix', - tag = 'cookie_fix', + url = 'git://github.com/tarantool/http.git', + tag = '1.0.2' } description = { summary = "HTTP server for Tarantool", diff --git a/rockspecs/http-scm-1.rockspec b/rockspecs/http-scm-1.rockspec index 4874309..23736f7 100644 --- a/rockspecs/http-scm-1.rockspec +++ b/rockspecs/http-scm-1.rockspec @@ -1,9 +1,8 @@ package = 'http' version = 'scm-1' source = { - url = 'git://github.com/get-net/http.git', - tag = 'cookie_fix', - branch = 'cookie_fix', + url = 'git://github.com/tarantool/http.git', + branch = 'master', } description = { summary = "HTTP server for Tarantool", From 3f64db6eeb016f01a75b4b5615ad66b558a4fb74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A8=D0=B8=D0=BF=D0=B8=D1=86=D1=8B=D0=BD=20=D0=90=D0=BD?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D0=BB=D0=B8=D0=B9?= Date: Fri, 17 May 2019 12:55:46 +0500 Subject: [PATCH 4/6] Revert local changes --- rockspecs/http-1.0.1-1.rockspec | 2 +- rockspecs/http-1.0.2-1.rockspec | 2 +- rockspecs/http-scm-1.rockspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rockspecs/http-1.0.1-1.rockspec b/rockspecs/http-1.0.1-1.rockspec index 947284f..8d40609 100644 --- a/rockspecs/http-1.0.1-1.rockspec +++ b/rockspecs/http-1.0.1-1.rockspec @@ -6,7 +6,7 @@ source = { } description = { summary = 'HTTP server for Tarantool', - homepage = 'https://github.com/get-net/http/', + homepage = 'https://github.com/tarantool/http/', license = 'BSD', } dependencies = { diff --git a/rockspecs/http-1.0.2-1.rockspec b/rockspecs/http-1.0.2-1.rockspec index 5e82c46..8d093f0 100644 --- a/rockspecs/http-1.0.2-1.rockspec +++ b/rockspecs/http-1.0.2-1.rockspec @@ -6,7 +6,7 @@ source = { } description = { summary = "HTTP server for Tarantool", - homepage = 'https://github.com/get-net/http/', + homepage = 'https://github.com/tarantool/http/', license = 'BSD', } dependencies = { diff --git a/rockspecs/http-scm-1.rockspec b/rockspecs/http-scm-1.rockspec index 23736f7..3713e0a 100644 --- a/rockspecs/http-scm-1.rockspec +++ b/rockspecs/http-scm-1.rockspec @@ -6,7 +6,7 @@ source = { } description = { summary = "HTTP server for Tarantool", - homepage = 'https://github.com/get-net/http/', + homepage = 'https://github.com/tarantool/http/', license = 'BSD', } dependencies = { From d6d7a9dcdaaf8136d604cd9bd7d4dc32a6182bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A8=D0=B8=D0=BF=D0=B8=D1=86=D1=8B=D0=BD=20=D0=90=D0=BD?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D0=BB=D0=B8=D0=B9?= Date: Fri, 17 May 2019 13:24:11 +0500 Subject: [PATCH 5/6] Revert local changes --- rockspecs/http-1.0.1-1.rockspec | 2 +- rockspecs/http-1.0.2-1.rockspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rockspecs/http-1.0.1-1.rockspec b/rockspecs/http-1.0.1-1.rockspec index 8d40609..e328c41 100644 --- a/rockspecs/http-1.0.1-1.rockspec +++ b/rockspecs/http-1.0.1-1.rockspec @@ -5,7 +5,7 @@ source = { tag = '1.0.1', } description = { - summary = 'HTTP server for Tarantool', + summary = "HTTP server for Tarantool", homepage = 'https://github.com/tarantool/http/', license = 'BSD', } diff --git a/rockspecs/http-1.0.2-1.rockspec b/rockspecs/http-1.0.2-1.rockspec index 8d093f0..31b5ed7 100644 --- a/rockspecs/http-1.0.2-1.rockspec +++ b/rockspecs/http-1.0.2-1.rockspec @@ -2,7 +2,7 @@ package = 'http' version = '1.0.2-1' source = { url = 'git://github.com/tarantool/http.git', - tag = '1.0.2' + tag = '1.0.2', } description = { summary = "HTTP server for Tarantool", From 1c8c9b2b39fe63a6efd4316617c2b95bbfefab64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A8=D0=B8=D0=BF=D0=B8=D1=86=D1=8B=D0=BD=20=D0=90=D0=BD?= =?UTF-8?q?=D0=B0=D1=82=D0=BE=D0=BB=D0=B8=D0=B9?= Date: Fri, 17 May 2019 13:41:58 +0500 Subject: [PATCH 6/6] Remove double quotation mark in Expries in Set-Cookie. It not need From RFC 6265 (4.1.1 section): expires-av = "Expires=" sane-cookie-date sane-cookie-date = --- http/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http/server.lua b/http/server.lua index 4bbb106..e7dac9a 100644 --- a/http/server.lua +++ b/http/server.lua @@ -286,7 +286,7 @@ local function setcookie(resp, cookie) end if cookie.expires ~= nil then - str = sprintf('%s;expires="%s"', str, expires_str(cookie.expires)) + str = sprintf('%s;expires=%s', str, expires_str(cookie.expires)) end if not resp.headers then